pub enum ArgValueReq {
Required {
default: Option<ArgValue>,
class: ValueClass,
},
Optional(ValueClass),
Prohibited,
}
Expand description
Requirements for attribute or named argument value presence
Variants§
Required
Argument must hold a value with the provided class
Optional(ValueClass)
Argument or an attribute may or may not hold a value
Prohibited
Argument or an attribute must not hold a value
Implementations§
Source§impl ArgValueReq
impl ArgValueReq
Sourcepub fn with_default(default: impl Into<ArgValue>) -> ArgValueReq
pub fn with_default(default: impl Into<ArgValue>) -> ArgValueReq
Constructs argument requirements object with default value
Sourcepub fn required(class: impl Into<ValueClass>) -> ArgValueReq
pub fn required(class: impl Into<ValueClass>) -> ArgValueReq
Construct ArgValueReq::Required
variant with no default value
Sourcepub fn optional(class: impl Into<ValueClass>) -> ArgValueReq
pub fn optional(class: impl Into<ValueClass>) -> ArgValueReq
Construct ArgValueReq::Optional
variant
Sourcepub fn value_class(&self) -> Option<ValueClass>
pub fn value_class(&self) -> Option<ValueClass>
Returns value class requirements, if any
Sourcepub fn default_value(&self) -> ArgValue
pub fn default_value(&self) -> ArgValue
Returns default argument value. If not default is provided within the
requirement, returns ArgValue::None
(since this is de facto
default value for any argument).
Sourcepub fn is_required(&self) -> bool
pub fn is_required(&self) -> bool
Determines whether argument is required to have a value
Trait Implementations§
Source§impl Clone for ArgValueReq
impl Clone for ArgValueReq
Source§fn clone(&self) -> ArgValueReq
fn clone(&self) -> ArgValueReq
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for ArgValueReq
impl RefUnwindSafe for ArgValueReq
impl !Send for ArgValueReq
impl !Sync for ArgValueReq
impl Unpin for ArgValueReq
impl UnwindSafe for ArgValueReq
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 272 bytes
Size for each variant:
Required
: 272 bytesOptional
: 10 bytesProhibited
: 0 bytes