Skip to content

Commit

Permalink
Minor beauty improvement of doctests.
Browse files Browse the repository at this point in the history
  • Loading branch information
raldone01 committed Dec 22, 2024
1 parent 6b4de0e commit 4cea7d7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ Note: No modifications on the *target* traits are necessary. Which allows you to
## Example

```rust
#![cfg_attr(feature = "min_specialization", feature(min_specialization))]
#![feature(ptr_metadata)]
# #![cfg_attr(feature = "min_specialization", feature(min_specialization))]
# #![feature(ptr_metadata)]
use trait_cast::{
make_trait_castable, TraitcastableAny, TraitcastableAnyInfra, TraitcastableAnyInfraExt,
};
Expand Down
36 changes: 18 additions & 18 deletions macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,30 @@ impl quote::ToTokens for TraitCastTargets {
/// supposed to be downcastable from a dyn `TraitcastableAny`.
///
/// Example:
/// ```no_build
/// extern crate trait_cast_rs;
/// ```ignore
/// extern crate trait_cast;
///
/// use trait_cast::{make_trait_castable, TraitcastTarget, TraitcastTo, TraitcastableAny};
/// use trait_cast::{make_trait_castable, TraitcastTarget, TraitcastTo, TraitcastableAny};
///
///
/// #[make_trait_castable(Print)]
/// struct Source(i32);
/// #[make_trait_castable(Print)]
/// struct Source(i32);
///
/// trait Print {
/// fn print(&self);
/// }
/// impl Print for Source {
/// fn print(&self) {
/// println!("{}", self.0)
/// }
/// trait Print {
/// fn print(&self);
/// }
/// impl Print for Source {
/// fn print(&self) {
/// println!("{}", self.0)
/// }
/// }
///
/// fn main() {
/// let source = Box::new(Source(5));
/// let castable: Box<dyn TraitcastableAny> = source;
/// let x: &dyn Print = castable.downcast_ref().unwrap();
/// x.print();
/// }
/// fn main() {
/// let source = Box::new(Source(5));
/// let castable: Box<dyn TraitcastableAny> = source;
/// let x: &dyn Print = castable.downcast_ref().unwrap();
/// x.print();
/// }
/// ```
#[proc_macro_attribute]
pub fn make_trait_castable(args: TokenStream1, input: TokenStream1) -> TokenStream1 {
Expand Down
2 changes: 1 addition & 1 deletion src/decl_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// Syntax: `<concrete struct/enum/union> => (<target traits>, ...)`
///
/// # Usage
/// ```no_build
/// ```ignore
/// make_trait_castable_decl! {
/// SrcStruct1 => (DstTrait1, DstTrait2),
/// SrcStruct2 => (DstTrait3, DstTrait4),
Expand Down

0 comments on commit 4cea7d7

Please sign in to comment.