pub struct Param {
pub name: String,
pub ty: Type,
pub default: Option<DefaultValue>,
pub optional: bool,
pub rest: bool,
}Fields§
§name: String§ty: Type§default: Option<DefaultValue>§optional: boolWhether a caller may omit the argument. Signatures the typechecker
builds from source set it for ? and for defaulted parameters alike,
but a host declaration may give only default, so readers ask
Param::is_omittable, which covers both.
rest: boolCallee sees T[]; call-site collects trailing args into a fresh array.
Implementations§
Source§impl Param
impl Param
Sourcepub fn is_omittable(&self) -> bool
pub fn is_omittable(&self) -> bool
Whether a caller may leave the argument out: declared ?, or defaulted.
Source§impl Param
impl Param
pub fn new(name: impl Into<String>, ty: Type) -> Self
pub fn with_default( name: impl Into<String>, ty: Type, default: DefaultValue, ) -> Self
Sourcepub fn optional(name: impl Into<String>, ty: Type) -> Self
pub fn optional(name: impl Into<String>, ty: Type) -> Self
The caller may omit this parameter, supplying undefined.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Param
impl<'de> Deserialize<'de> for Param
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Param
Auto Trait Implementations§
impl Freeze for Param
impl RefUnwindSafe for Param
impl Send for Param
impl Sync for Param
impl Unpin for Param
impl UnsafeUnpin for Param
impl UnwindSafe for Param
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