Struct rune::ast::AngleBracketed[][src]

pub struct AngleBracketed<T, S> {
    pub open: Lt,
    pub angle_bracketed: Vec<(T, Option<S>)>,
    pub close: Gt,
}

Parse something bracketed, that is separated by <(T, S?)*>.

Examples

use rune::{T, testing, ast};

testing::roundtrip::<ast::AngleBracketed<ast::Path, T![,]>>("<Foo, Bar>");
testing::roundtrip::<ast::AngleBracketed<ast::ExprWithoutBinary, T![,]>>("<1, \"two\">");
testing::roundtrip::<ast::AngleBracketed<ast::ExprWithoutBinary, T![,]>>("<1, 2,>");
testing::roundtrip::<ast::AngleBracketed<ast::ExprWithoutBinary, T![,]>>("<1, 2, foo()>");

Fields

open: Lt

The open parenthesis.

angle_bracketed: Vec<(T, Option<S>)>

Values in the type.

close: Gt

The close parenthesis.

Implementations

impl<T, S> AngleBracketed<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> AngleBracketed<T, S> where
    T: Parse,
    S: Peek + Parse
[src]

pub fn parse_from_first(
    parser: &mut Parser<'_>,
    open: Lt,
    current: T
) -> Result<Self, ParseError>
[src]

Parse with the first element already specified.

Trait Implementations

impl<T: Clone, S: Clone> Clone for AngleBracketed<T, S>[src]

impl<T: Debug, S: Debug> Debug for AngleBracketed<T, S>[src]

impl<T: Eq, S: Eq> Eq for AngleBracketed<T, S>[src]

impl<'a, T, S> IntoIterator for &'a AngleBracketed<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?

impl<'a, T, S> IntoIterator for &'a mut AngleBracketed<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?

impl<T, S> IntoIterator for AngleBracketed<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?

impl<T, S> Parse for AngleBracketed<T, S> where
    T: Parse,
    S: Peek + Parse
[src]

impl<T: PartialEq, S: PartialEq> PartialEq<AngleBracketed<T, S>> for AngleBracketed<T, S>[src]

impl<T, S> Peek for AngleBracketed<T, S>[src]

impl<T, S> Spanned for AngleBracketed<T, S>[src]

impl<T, S> StructuralEq for AngleBracketed<T, S>[src]

impl<T, S> StructuralPartialEq for AngleBracketed<T, S>[src]

impl<T, S> ToTokens for AngleBracketed<T, S> where
    T: ToTokens,
    S: ToTokens
[src]

Auto Trait Implementations

impl<T, S> RefUnwindSafe for AngleBracketed<T, S> where
    S: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, S> Send for AngleBracketed<T, S> where
    S: Send,
    T: Send

impl<T, S> Sync for AngleBracketed<T, S> where
    S: Sync,
    T: Sync

impl<T, S> Unpin for AngleBracketed<T, S> where
    S: Unpin,
    T: Unpin

impl<T, S> UnwindSafe for AngleBracketed<T, S> where
    S: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.