Struct wgsl_parser::decl::import::ImportPathDecl

source ·
pub struct ImportPathDecl {
    pub keyword: Token,
    pub path: ImportPath,
}
Expand description

Represents a #define_import_path statement like the ones supported by naga_oil:

#define_import_path my::shader::module

Fields§

§keyword: Token§path: ImportPath

Implementations§

source§

impl ImportPathDecl

source

pub fn name(&self) -> &Token

Returns the token at the leaf node of this declaration.

I.e., for the following import path declaration:

#define_import_path foo::bar::baz

This function will return the bar token at the end of the line.

source§

impl ImportPathDecl

source

pub fn qualified_path(&self) -> Arc<[Token]>

Returns the fully-qualified path defined by this declaration as an array of tokens.

I.e., for the following import path declaration:

#define_import_path foo::bar::baz

This function will return the tokens [foo, bar, baz].

source

pub fn qualified_name(&self) -> Token

Returns an ad-hoc Token::Path that represents a combination of the tokens that make up the path defined by this declaration.

I.e., for the following import path declaration:

#define_import_path foo::bar::baz

This function will return a Token::Path("foo::bar::baz", (1:21..1:34)).

The token returned by this function is created by this function by “joining” the tokens actually contained in the ImportPath into a single token. This is in contrast to qualified_path, which returns the actual sequence of tokens contained in the ImportPath.

Trait Implementations§

source§

impl Clone for ImportPathDecl

source§

fn clone(&self) -> ImportPathDecl

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ImportPathDecl

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl DebugLisp for ImportPathDecl

source§

fn fmt(&self, f: &mut Formatter<'_>, indent: usize) -> Result

source§

impl Parse for ImportPathDecl

§

type Stream = ParseStream

source§

fn parse(input: &mut Self::Stream) -> Result<Self>

source§

impl Spanned for ImportPathDecl

source§

fn span(&self) -> Span

source§

impl Tooltip for ImportPathDecl

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

source§

impl Walk for ImportPathDecl

source§

fn walk(&self, visitor: &mut dyn Visitor)

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.