Struct rune::ast::Path[][src]

pub struct Path {
    pub id: Option<Id>,
    pub global: Option<ColonColon>,
    pub first: PathSegment,
    pub rest: Vec<(ColonColon, PathSegment)>,
    pub trailing: Option<ColonColon>,
}
Expand description

A path, where each element is separated by a ::.

Examples

use rune::{testing, ast};

testing::roundtrip::<ast::Path>("foo::bar");
testing::roundtrip::<ast::Path>("Self::bar");
testing::roundtrip::<ast::Path>("self::bar");
testing::roundtrip::<ast::Path>("crate::bar");
testing::roundtrip::<ast::Path>("super::bar");
testing::roundtrip::<ast::Path>("HashMap::<Foo, Bar>");
testing::roundtrip::<ast::Path>("super::HashMap::<Foo, Bar>");

Fields

id: Option<Id>

Opaque id associated with path.

global: Option<ColonColon>

The optional leading colon :: indicating global scope.

first: PathSegment

The first component in the path.

rest: Vec<(ColonColon, PathSegment)>

The rest of the components in the path.

trailing: Option<ColonColon>

Trailing scope.

Implementations

Identify the kind of the path.

Borrow as an identifier used for field access calls.

This is only allowed if there are no other path components and the path segment is not Crate or Super.

Borrow as an identifier used for field access calls.

This is only allowed if there are no other path components and the path segment is not Crate or Super.

Iterate over all components in path.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Parse the current item from the parser.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Peek the parser for the given token.

Resolve implementation for path which “stringifies” it.

The output type being resolved into.

Resolve the value from parsed AST.

The output type being resolved into.

Resolve into an owned value.

Get the span of the type.

Turn the current item into tokens.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.