Struct full_moon::ast::punctuated::Punctuated [−][src]
pub struct Punctuated<'a, T> { /* fields omitted */ }
Expand description
A punctuated sequence of node T
separated by
TokenReference
.
Refer to the module documentation for more details.
Implementations
Creates an empty punctuated sequence
let mut punctuated: Punctuated<i32> = Punctuated::new();
Returns whether there’s any nodes in the punctuated sequence
let mut punctuated = Punctuated::new(); assert!(punctuated.is_empty()); punctuated.push(Pair::new((), None)); assert!(!punctuated.is_empty());
Returns the number of pairs in the punctuated sequence
let mut punctuated = Punctuated::new(); assert_eq!(punctuated.len(), 0); punctuated.push(Pair::new((), None)); assert_eq!(punctuated.len(), 1);
Returns an iterator over references of the sequence values, ignoring punctuation
let mut punctuated = Punctuated::new(); punctuated.push(Pair::new(1, None)); let mut iterator = punctuated.iter(); assert_eq!(iterator.next(), Some(&1)); assert_eq!(iterator.next(), None);
Returns an iterator over mutable references of the sequence values, ignoring punctuation
let mut punctuated = Punctuated::new(); punctuated.push(Pair::new(1, None)); for item in punctuated.iter_mut() { *item += 1; } assert_eq!(punctuated.pop(), Some(Pair::new(2, None)));
Returns an iterator over pairs
let mut punctuated = Punctuated::new(); punctuated.push(Pair::new(1, None)); let mut iterator = punctuated.into_pairs(); assert_eq!(iterator.next(), Some(Pair::new(1, None))); assert_eq!(iterator.next(), None);
Returns the last pair in the sequence
let mut punctuated = Punctuated::new(); punctuated.push(Pair::new(1, None)); assert_eq!(punctuated.last(), Some(&Pair::new(1, None)));
Returns an iterator over pairs as references
let mut punctuated = Punctuated::new(); punctuated.push(Pair::new(1, None)); let mut iterator = punctuated.pairs(); assert_eq!(iterator.next(), Some(&Pair::new(1, None))); assert_eq!(iterator.next(), None);
Returns an iterator over pairs as mutable references
let mut punctuated = Punctuated::new(); punctuated.push(Pair::new(1, None)); for item in punctuated.pairs_mut() { *item.value_mut() += 1; } assert_eq!(punctuated.pop(), Some(Pair::new(2, None)));
Pops off the last pair if it isn’t empty
let mut punctuated = Punctuated::new(); punctuated.push(Pair::new(1, None)); assert_eq!(punctuated.pop(), Some(Pair::new(1, None)));
Trait Implementations
Returns the “default value” for a type. Read more
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
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Punctuated<'a, T> where
T: RefUnwindSafe,
impl<'a, T> Send for Punctuated<'a, T> where
T: Send,
impl<'a, T> Sync for Punctuated<'a, T> where
T: Sync,
impl<'a, T> Unpin for Punctuated<'a, T> where
T: Unpin,
impl<'a, T> UnwindSafe for Punctuated<'a, T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more