pub struct Param {
pub id: String,
pub type: ParamType,
}
Expand description
Parameter
A parameter is an identifier that appears in a parameter expansion
(TextUnit::RawParam
and BracedParam
). There are three
types of parameters depending on the character category of the
identifier.
Fields§
§id: String
Literal representation of the parameter name
This is the raw string form of the parameter as it appears in the source
code. Examples include foo
, @
, #
, 0
, and 12
.
type: ParamType
Type of the parameter
This precomputed value is used to optimize the evaluation of parameter
expansions by avoiding the need to parse the id
field every time.
It is your responsibility to ensure that the type
field is consistent
with the id
field. For example, if the id
field is "@"
, the type
field must be Special(At)
. The parser ensures this
invariant when it constructs a Param
value.
Implementations§
Trait Implementations§
Source§impl From<SpecialParam> for Param
Constructs a Param
value representing a special parameter.
impl From<SpecialParam> for Param
Constructs a Param
value representing a special parameter.
Source§fn from(special: SpecialParam) -> Param
fn from(special: SpecialParam) -> Param
impl Eq for Param
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 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
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