[][src]Struct bracket::parser::ast::Component

pub struct Component<'source> { /* fields omitted */ }

Components form part of a path.

Implementations

impl<'source> Component<'source>[src]

pub fn new(
    source: &'source str,
    kind: ComponentType,
    span: Range<usize>,
    value: Option<String>
) -> Self
[src]

Create a new component path.

If a component path contains escape sequences an owned value should be given otherwise the component path will use the supplied span.

pub fn is_root(&self) -> bool[src]

Determine if this is the special @root component.

pub fn kind(&self) -> &ComponentType[src]

Get the kind of this component.

pub fn span(&self) -> &Range<usize>[src]

The span for this component.

pub fn is_local(&self) -> bool[src]

Determine if this component is a local identifier; begins with an @ symbol.

pub fn is_identifier(&self) -> bool[src]

Determine if this component is an identifier.

pub fn is_explicit(&self) -> bool[src]

Determine if this component uses an explicit this reference; the reference may be the keyword this or ./.

pub fn is_explicit_dot_slash(&self) -> bool[src]

Determine if this component uses and explicit dot slash (./) reference.

This is used by the path parser to determine if the next expected token should be a path delimiter or identifier.

pub fn as_value(&self) -> &str[src]

Get the underlying value for the path component.

If an owned value has been given to this path component (which is necessary when the path component includes escape sequences) then a reference to the owned value is returned otherwise a string slice into the original template for the span assigned to this component path is returned.

When performing lookup of values using a path a caller must use this function and not as_str() otherwise literal strings with escape sequences will not be respected.

Trait Implementations

impl<'_> Debug for Component<'_>[src]

impl<'_> Display for Component<'_>[src]

impl<'source> Eq for Component<'source>[src]

impl<'source> PartialEq<Component<'source>> for Component<'source>[src]

impl<'source> Slice<'source> for Component<'source>[src]

impl<'source> StructuralEq for Component<'source>[src]

impl<'source> StructuralPartialEq for Component<'source>[src]

Auto Trait Implementations

impl<'source> RefUnwindSafe for Component<'source>

impl<'source> Send for Component<'source>

impl<'source> Sync for Component<'source>

impl<'source> Unpin for Component<'source>

impl<'source> UnwindSafe for Component<'source>

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> ToString for T where
    T: Display + ?Sized
[src]

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.