Struct rune::ast::Braced [−][src]
Parse something braced, that is separated by {(T, S?)*}
.
Examples
use rune::{T, testing, ast}; testing::roundtrip::<ast::Braced<ast::Expr, T![,]>>("{1, \"two\"}"); testing::roundtrip::<ast::Braced<ast::Expr, T![,]>>("{1, 2,}"); testing::roundtrip::<ast::Braced<ast::Expr, T![,]>>("{1, 2, foo()}");
Fields
open: OpenBrace
The open parenthesis.
braced: Vec<(T, Option<S>)>
Values in the type.
close: CloseBrace
The close parenthesis.
Implementations
impl<T, S> Braced<T, S>
[src]
pub fn is_empty(&self) -> bool
[src]
Test if empty.
pub fn len(&self) -> usize
[src]
Get the length of the parsed elements.
pub fn first(&self) -> Option<&(T, Option<S>)>
[src]
Get the first element.
pub fn last(&self) -> Option<&(T, Option<S>)>
[src]
Get the last element.
pub fn iter(&self) -> Iter<'_, (T, Option<S>)>
[src]
Iterate over elements.
pub fn iter_mut(&mut self) -> IterMut<'_, (T, Option<S>)>
[src]
Iterate mutably over elements.
pub fn as_slice(&self) -> &[(T, Option<S>)]
[src]
Get the values as a slice.
impl<T, S> Braced<T, S> where
T: Parse,
S: Peek + Parse,
[src]
T: Parse,
S: Peek + Parse,
pub fn parse_from_first(
parser: &mut Parser<'_>,
open: OpenBrace,
current: T
) -> Result<Self, ParseError>
[src]
parser: &mut Parser<'_>,
open: OpenBrace,
current: T
) -> Result<Self, ParseError>
Parse with the first element already specified.
Trait Implementations
impl<T: Clone, S: Clone> Clone for Braced<T, S>
[src]
impl<T: Debug, S: Debug> Debug for Braced<T, S>
[src]
impl<T: Eq, S: Eq> Eq for Braced<T, S>
[src]
impl<'a, T, S> IntoIterator for &'a Braced<T, S>
[src]
type Item = &'a (T, Option<S>)
The type of the elements being iterated over.
type IntoIter = Iter<'a, (T, Option<S>)>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, T, S> IntoIterator for &'a mut Braced<T, S>
[src]
type Item = &'a mut (T, Option<S>)
The type of the elements being iterated over.
type IntoIter = IterMut<'a, (T, Option<S>)>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<T, S> IntoIterator for Braced<T, S>
[src]
type Item = (T, Option<S>)
The type of the elements being iterated over.
type IntoIter = IntoIter<(T, Option<S>)>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<T, S> Parse for Braced<T, S> where
T: Parse,
S: Peek + Parse,
[src]
T: Parse,
S: Peek + Parse,
fn parse(parser: &mut Parser<'_>) -> Result<Self, ParseError>
[src]
impl<T: PartialEq, S: PartialEq> PartialEq<Braced<T, S>> for Braced<T, S>
[src]
impl<T, S> Peek for Braced<T, S>
[src]
impl<T, S> Spanned for Braced<T, S>
[src]
impl<T, S> StructuralEq for Braced<T, S>
[src]
impl<T, S> StructuralPartialEq for Braced<T, S>
[src]
impl<T, S> ToTokens for Braced<T, S> where
T: ToTokens,
S: ToTokens,
[src]
T: ToTokens,
S: ToTokens,
fn to_tokens(&self, context: &MacroContext, stream: &mut TokenStream)
[src]
Auto Trait Implementations
impl<T, S> RefUnwindSafe for Braced<T, S> where
S: RefUnwindSafe,
T: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S> Send for Braced<T, S> where
S: Send,
T: Send,
S: Send,
T: Send,
impl<T, S> Sync for Braced<T, S> where
S: Sync,
T: Sync,
S: Sync,
T: Sync,
impl<T, S> Unpin for Braced<T, S> where
S: Unpin,
T: Unpin,
S: Unpin,
T: Unpin,
impl<T, S> UnwindSafe for Braced<T, S> where
S: UnwindSafe,
T: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,