pub struct EnumAttribute { /* private fields */ }
Implementations§
Source§impl EnumAttribute
impl EnumAttribute
Sourcepub fn new(
name: CheetahString,
changeable: bool,
universe: HashSet<CheetahString>,
default_value: CheetahString,
) -> Self
pub fn new( name: CheetahString, changeable: bool, universe: HashSet<CheetahString>, default_value: CheetahString, ) -> Self
Create a new enum attribute with the specified properties
§Arguments
name
- The name of the attributechangeable
- Whether the attribute can be changed after creationuniverse
- Set of valid values this attribute can takedefault_value
- Default value for this attribute (must be in universe)
§Returns
A new EnumAttribute instance, or an error if the default value is not in the universe
Sourcepub fn default_value(&self) -> &str
pub fn default_value(&self) -> &str
Get the default value for this attribute
Sourcepub fn universe(&self) -> &HashSet<CheetahString>
pub fn universe(&self) -> &HashSet<CheetahString>
Get the set of valid values for this attribute
Trait Implementations§
Source§impl Attribute for EnumAttribute
impl Attribute for EnumAttribute
Source§fn verify(&self, value: &str) -> Result<(), String>
fn verify(&self, value: &str) -> Result<(), String>
Verify that the provided string value is valid for this attribute.
Implementations should validate according to their specific rules.
Source§fn name(&self) -> &CheetahString
fn name(&self) -> &CheetahString
Get the name of this attribute.
Source§fn is_changeable(&self) -> bool
fn is_changeable(&self) -> bool
Check if this attribute can be changed after creation.
Source§impl Clone for EnumAttribute
impl Clone for EnumAttribute
Source§fn clone(&self) -> EnumAttribute
fn clone(&self) -> EnumAttribute
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl !Freeze for EnumAttribute
impl RefUnwindSafe for EnumAttribute
impl Send for EnumAttribute
impl Sync for EnumAttribute
impl Unpin for EnumAttribute
impl UnwindSafe for EnumAttribute
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more