pub enum ParamType {
Variable,
Special(SpecialParam),
Positional(usize),
}
Expand description
Type of a parameter
This enum distinguishes three types of parameters: named, special and positional parameters. However, this value does not include the actual parameter name as a string. The actual name is stored in a separate field in the AST node that contains this value.
Note the careful use of the term “name” here. In POSIX terminology, a “name” identifies a named parameter (that is, a variable) and does not include special or positional parameters. An identifier that refers to any kind of parameter is called a “parameter”.
Variants§
Variable
Named parameter
Special(SpecialParam)
Special parameter
Positional(usize)
Positional parameter
Positional parameters are indexed starting from 1, so the index of 0
always refers to a non-existent parameter. If the string form of a
positional parameter represents an index that is too large to fit in a
usize
, the index should be usize::MAX
, which is also guaranteed to
spot a non-existent parameter since a Vec
cannot have more than
isize::MAX
elements.
Trait Implementations§
Source§impl From<SpecialParam> for ParamType
impl From<SpecialParam> for ParamType
Source§fn from(special: SpecialParam) -> ParamType
fn from(special: SpecialParam) -> ParamType
impl Copy for ParamType
impl Eq for ParamType
impl StructuralPartialEq for ParamType
Auto Trait Implementations§
impl Freeze for ParamType
impl RefUnwindSafe for ParamType
impl Send for ParamType
impl Sync for ParamType
impl Unpin for ParamType
impl UnwindSafe for ParamType
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,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more