pub struct AssetPath { /* private fields */ }Expand description
A path to an asset, optionally qualified with a sub-asset label.
The syntax is "path/to/file.ext" or "path/to/file.ext#label".
Sub-asset labels allow a single file to expose multiple logical assets.
For example a GLTF file can expose "scene.gltf#mesh0", "scene.gltf#mesh1".
§Example
use proof_engine::asset::AssetPath;
let p = AssetPath::parse("models/robot.gltf#body_mesh");
assert_eq!(p.path().to_str().unwrap(), "models/robot.gltf");
assert_eq!(p.label(), Some("body_mesh"));Implementations§
Source§impl AssetPath
impl AssetPath
Sourcepub fn with_label<P: AsRef<Path>>(path: P, label: impl Into<String>) -> Self
pub fn with_label<P: AsRef<Path>>(path: P, label: impl Into<String>) -> Self
Create a path with an explicit sub-asset label.
Sourcepub fn parse(s: &str) -> Self
pub fn parse(s: &str) -> Self
Parse a combined "path#label" string.
If no # is present the label is None.
Sourcepub fn extension(&self) -> Option<String>
pub fn extension(&self) -> Option<String>
File extension of the path (without the dot), lowercased.
Sourcepub fn to_string_repr(&self) -> String
pub fn to_string_repr(&self) -> String
Returns the canonical string representation "path" or "path#label".
Trait Implementations§
impl Eq for AssetPath
impl StructuralPartialEq for AssetPath
Auto Trait Implementations§
impl Freeze for AssetPath
impl RefUnwindSafe for AssetPath
impl Send for AssetPath
impl Sync for AssetPath
impl Unpin for AssetPath
impl UnsafeUnpin for AssetPath
impl UnwindSafe for AssetPath
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.