[−][src]Struct edres::EnumOptions
Options for configuring the generation of a struct.
Fields
format: Option<Format>The format of the source data.
Defaults to None which will cause it to be inferred from the
file type.
enum_name: StringThe name of the resulting enum.
Defaults to "Key".
all_variants_const: Option<String>The name of the const slice containing all variants.
For example, if you specify Some("ALL"), then
MyEnum::ALL will contain all variants of the enum.
If you specify None then no constant will be
generated.
Defaults to Some("ALL").
derived_traits: Vec<String>A list of traits for the struct to derive.
Defaults to ["Debug", "Clone", "Copy", "PartialEq", "Eq", "PartialOrd", "Ord", "Hash"]
(Note that the serde_support option below may add
to this list.)
first_variant_is_default: boolWhether to implement the Default trait for this enum.
If true then the default value will be the first
variant specified.
Defaults to true.
impl_display: boolWhether to implement the Display trait for this enum.
This requires the Debug trait to be implemented.
Defaults to true.
impl_from_str: boolWhether to implement the FromStr trait for this enum.
This requires the all_variants_const to be set to
something other than None.
Defaults to true.
serde_support: SerdeSupportShorthand for generating the Serialize and Deserialize traits.
Defaults to No.
use_serde_derive_crate: boolThe recommended way to derive Serialize and Deserialize
is via the serde crate's
derive feature.
If you instead need to use the old method of including
the serde_derive crate, set this flag to true.
create_dirs: boolWhether or not to create the parent directories of the output file, if they don't exist.
Defaults to true.
write_only_if_changed: boolWhether to check if the destination file would be changed before writing output.
This is to avoid unnecessary writes from marking the
destination file as changed (which could, for example,
trigger a process which is watching for changes). This
option only works with the create_* functions.
Defaults to true.
Implementations
impl EnumOptions[src]
pub fn serde_default() -> Self[src]
The default options plus serde support. This includes
Serialize/Deserialize traits, plus helpers functions
to load the config.
use edres::{EnumOptions, SerdeSupport}; let options = EnumOptions::serde_default(); assert_eq!(options, EnumOptions { serde_support: SerdeSupport::Yes, .. EnumOptions::default() });
Trait Implementations
impl Clone for EnumOptions[src]
pub fn clone(&self) -> EnumOptions[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Debug for EnumOptions[src]
impl Default for EnumOptions[src]
Defaults to ["Debug", "Clone", "Copy", "PartialEq", "Eq", "PartialOrd", "Ord", "Hash"]
pub fn default() -> Self[src]
use edres::*; let default_options = EnumOptions { format: None, enum_name: "Key".to_owned(), all_variants_const: Some("ALL".to_owned()), derived_traits: vec![ "Debug".to_owned(), "Clone".to_owned(), "Copy".to_owned(), "PartialEq".to_owned(), "Eq".to_owned(), "PartialOrd".to_owned(), "Ord".to_owned(), "Hash".to_owned(), ], first_variant_is_default: true, impl_display: true, impl_from_str: true, serde_support: SerdeSupport::No, use_serde_derive_crate: false, create_dirs: true, write_only_if_changed: true, }; assert_eq!(default_options, EnumOptions::default());
impl Eq for EnumOptions[src]
impl PartialEq<EnumOptions> for EnumOptions[src]
pub fn eq(&self, other: &EnumOptions) -> bool[src]
pub fn ne(&self, other: &EnumOptions) -> bool[src]
impl StructuralEq for EnumOptions[src]
impl StructuralPartialEq for EnumOptions[src]
Auto Trait Implementations
impl RefUnwindSafe for EnumOptions
impl Send for EnumOptions
impl Sync for EnumOptions
impl Unpin for EnumOptions
impl UnwindSafe for EnumOptions
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,