Enum full_moon::ast::punctuated::Pair [−][src]
pub enum Pair<'a, T> { End(T), Punctuated(T, TokenReference<'a>), }
Expand description
A node T
followed by the possible trailing
TokenReference
.
Refer to the module documentation for more details.
Variants
A node T
with no trailing punctuation
Punctuated(T, TokenReference<'a>)
A node T
followed by punctuation (in the form of a
TokenReference
)
Implementations
Creates a Pair
with node T
and optional punctuation
let pair = Pair::new(1, None);
Takes the Pair
and returns the node T
and the punctuation, if it exists as a tuple
let pair = Pair::new(1, None); assert_eq!(pair.into_tuple(), (1, None));
Takes the Pair
and returns the node T
let pair = Pair::new(1, None); assert_eq!(pair.into_value(), 1);
Returns a reference to the node T
let pair = Pair::new(1, None); assert_eq!(pair.value(), &1);
Returns a mutable reference to the node T
let mut pair = Pair::new(1, None); *pair.value_mut() += 1; assert_eq!(pair.into_value(), 2);
Returns the trailing punctuation, if it exists
let pair = Pair::new(1, None); assert_eq!(pair.punctuation(), None);
Trait Implementations
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
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Creates a value from an iterator. Read more
The start position of a node. None if can’t be determined
The end position of a node. None if it can’t be determined
Whether another node of the same type is the same as this one semantically, ignoring position
The token references that comprise a node
The full range of a node, if it has both start and end positions
The tokens surrounding a node that are ignored and not accessible through the node’s own accessors. Use this if you want to get surrounding comments or whitespace. Returns a tuple of the leading and trailing trivia. Read more
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Pair<'a, T> where
T: RefUnwindSafe,
impl<'a, T> UnwindSafe for Pair<'a, T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more