Enum amplify_syn::ArgValueReq
source · 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
Returns a copy 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 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
Mutably borrows from an owned value. Read more