pub struct ModulePath {
pub origin: PathOrigin,
pub components: Vec<String>,
}
Fields§
§origin: PathOrigin
§components: Vec<String>
Implementations§
Source§impl ModulePath
impl ModulePath
Sourcepub fn new(origin: PathOrigin, components: Vec<String>) -> ModulePath
pub fn new(origin: PathOrigin, components: Vec<String>) -> ModulePath
Create a new module path from components.
Precondition: the path components must be valid WGSL identifiers.
Sourcepub fn from_path(path: impl AsRef<Path>) -> ModulePath
pub fn from_path(path: impl AsRef<Path>) -> ModulePath
Create a new module path from a filesystem path.
- Paths with a root (leading
/
on Unix) producepackage::
paths. - Relative paths (starting with
.
or..
) produceself::
orsuper::
paths. - The file extension is ignored.
- The path is canonicalized and to do so it does NOT follow symlinks.
Precondition: the path components must be valid WGSL identifiers.
Sourcepub fn to_path_buf(&self) -> PathBuf
pub fn to_path_buf(&self) -> PathBuf
Create a PathBuf
from a ModulePath
.
package::
paths are rooted (start with/
).- self::
or
super::are relative (starting with
.or
..)
. - There is no file extension.
Sourcepub fn push(&mut self, item: &str)
pub fn push(&mut self, item: &str)
Append a component to the path.
Precondition: the item
must be a valid WGSL identifier.
Sourcepub fn join(self, suffix: impl IntoIterator<Item = String>) -> ModulePath
pub fn join(self, suffix: impl IntoIterator<Item = String>) -> ModulePath
Append suffix
to the module path.
Sourcepub fn join_path(&self, path: &ModulePath) -> Option<ModulePath>
pub fn join_path(&self, path: &ModulePath) -> Option<ModulePath>
Append suffix
to the module path.
the suffix must be a relative module path.
pub fn starts_with(&self, prefix: &ModulePath) -> bool
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for ModulePath
impl Clone for ModulePath
Source§fn clone(&self) -> ModulePath
fn clone(&self) -> ModulePath
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ModulePath
impl Debug for ModulePath
Source§impl Default for ModulePath
impl Default for ModulePath
Source§fn default() -> ModulePath
fn default() -> ModulePath
The path that is represented as ``, i.e. a package import with no components.
Source§impl Display for ModulePath
impl Display for ModulePath
Source§impl<T> From<T> for ModulePath
impl<T> From<T> for ModulePath
Source§fn from(value: T) -> ModulePath
fn from(value: T) -> ModulePath
Converts to this type from the input type.
Source§impl Hash for ModulePath
impl Hash for ModulePath
Source§impl PartialEq for ModulePath
impl PartialEq for ModulePath
impl Eq for ModulePath
impl StructuralPartialEq for ModulePath
Auto Trait Implementations§
impl Freeze for ModulePath
impl RefUnwindSafe for ModulePath
impl Send for ModulePath
impl Sync for ModulePath
impl Unpin for ModulePath
impl UnwindSafe for ModulePath
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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