Skip to content

Commit

Permalink
Correct docs on tuple enums
Browse files Browse the repository at this point in the history
  • Loading branch information
xd009642 committed Aug 15, 2023
1 parent 000e7c4 commit d68c032
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions fake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,25 +296,26 @@ pub mod locales;
/// let f: Foo = Faker.fake();
/// ```
///
/// A simple example for deriving [`Dummy`] on an enum. Unfortunately, the `faker` key cannot yet
/// be used on tuple enum variants. However, it can be used on fields within struct enum variants.
/// A simple example for deriving [`Dummy`] on an enum. For enum tuple variants the faker attribute
/// is applied directly to the types in the tuple, for struct variants it is applied on each struct
/// field.
///
/// ```
/// use fake::{Dummy, Fake, Faker};
/// use fake::faker::name::en::Name;
///
/// #[derive(Dummy)]
/// pub struct Bar {
/// pub enum Bar {
/// Simple,
/// Tuple(i32),
/// Tuple(#[dummy(faker="0..5")] i32),
/// Structure {
/// #[dummy(faker = "1000..2000")]
/// i: usize,
/// j: String,
/// }
/// }
///
/// let f: Foo = Faker.fake();
/// let b: Bar = Faker.fake();
/// ```
#[cfg(feature = "derive")]
pub use dummy::Dummy;
Expand Down

0 comments on commit d68c032

Please sign in to comment.