Struct rin::scene::components::SourcePath [−][src]
pub struct SourcePath(pub PathBuf);
Methods from Deref<Target = PathBuf>
pub fn as_path(&self) -> &Path
1.0.0[src]
Coerces to a Path
slice.
Examples
use std::path::{Path, PathBuf}; let p = PathBuf::from("/test"); assert_eq!(Path::new("/test"), p.as_path());
pub fn push<P>(&mut self, path: P) where
P: AsRef<Path>,
1.0.0[src]
P: AsRef<Path>,
Extends self
with path
.
If path
is absolute, it replaces the current path.
On Windows:
- if
path
has a root but no prefix (e.g.,\windows
), it replaces everything except for the prefix (if any) ofself
. - if
path
has a prefix but no root, it replacesself
.
Examples
Pushing a relative path extends the existing path:
use std::path::PathBuf; let mut path = PathBuf::from("/tmp"); path.push("file.bk"); assert_eq!(path, PathBuf::from("/tmp/file.bk"));
Pushing an absolute path replaces the existing path:
use std::path::PathBuf; let mut path = PathBuf::from("/tmp"); path.push("/etc"); assert_eq!(path, PathBuf::from("/etc"));
pub fn pop(&mut self) -> bool
1.0.0[src]
Truncates self
to self.parent
.
Returns false
and does nothing if self.parent
is None
.
Otherwise, returns true
.
Examples
use std::path::{Path, PathBuf}; let mut p = PathBuf::from("/spirited/away.rs"); p.pop(); assert_eq!(Path::new("/spirited"), p); p.pop(); assert_eq!(Path::new("/"), p);
pub fn set_file_name<S>(&mut self, file_name: S) where
S: AsRef<OsStr>,
1.0.0[src]
S: AsRef<OsStr>,
Updates self.file_name
to file_name
.
If self.file_name
was None
, this is equivalent to pushing
file_name
.
Otherwise it is equivalent to calling pop
and then pushing
file_name
. The new path will be a sibling of the original path.
(That is, it will have the same parent.)
Examples
use std::path::PathBuf; let mut buf = PathBuf::from("/"); assert!(buf.file_name() == None); buf.set_file_name("bar"); assert!(buf == PathBuf::from("/bar")); assert!(buf.file_name().is_some()); buf.set_file_name("baz.txt"); assert!(buf == PathBuf::from("/baz.txt"));
pub fn set_extension<S>(&mut self, extension: S) -> bool where
S: AsRef<OsStr>,
1.0.0[src]
S: AsRef<OsStr>,
Updates self.extension
to extension
.
Returns false
and does nothing if self.file_name
is None
,
returns true
and updates the extension otherwise.
If self.extension
is None
, the extension is added; otherwise
it is replaced.
Examples
use std::path::{Path, PathBuf}; let mut p = PathBuf::from("/feel/the"); p.set_extension("force"); assert_eq!(Path::new("/feel/the.force"), p.as_path()); p.set_extension("dark_side"); assert_eq!(Path::new("/feel/the.dark_side"), p.as_path());
pub fn capacity(&self) -> usize
1.44.0[src]
pub fn clear(&mut self)
1.44.0[src]
pub fn reserve(&mut self, additional: usize)
1.44.0[src]
pub fn reserve_exact(&mut self, additional: usize)
1.44.0[src]
Invokes reserve_exact
on the underlying instance of OsString
.
pub fn shrink_to_fit(&mut self)
1.44.0[src]
Invokes shrink_to_fit
on the underlying instance of OsString
.
pub fn shrink_to(&mut self, min_capacity: usize)
[src]
shrink_to
)Trait Implementations
impl Clone for SourcePath
[src]
impl Clone for SourcePath
[src]pub fn clone(&self) -> SourcePath
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Component for SourcePath
[src]
impl Component for SourcePath
[src]type Storage = KeyedDenseVec<usize, SourcePath>
type MutStorageCacheGuard = ()
pub fn type_name() -> &'static str
[src]
pub fn is_reference() -> bool
[src]
pub fn id() -> TypeId
[src]
pub fn references_other(
) -> Option<Box<dyn Fn(&Storages, &Entity) + 'static, Global>>
[src]
) -> Option<Box<dyn Fn(&Storages, &Entity) + 'static, Global>>
impl<'a> DebugParameter for SourcePath
[src]
impl<'a> DebugParameter for SourcePath
[src]pub fn debug<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
impl Deref for SourcePath
[src]
impl Deref for SourcePath
[src]impl<'de> Deserialize<'de> for SourcePath
[src]
impl<'de> Deserialize<'de> for SourcePath
[src]pub fn deserialize<__D>(
__deserializer: __D
) -> Result<SourcePath, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<SourcePath, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl Hash for SourcePath
[src]
impl Hash for SourcePath
[src]impl Ord for SourcePath
[src]
impl Ord for SourcePath
[src]impl PartialEq<SourcePath> for SourcePath
[src]
impl PartialEq<SourcePath> for SourcePath
[src]pub fn eq(&self, other: &SourcePath) -> bool
[src]
pub fn ne(&self, other: &SourcePath) -> bool
[src]
impl PartialOrd<SourcePath> for SourcePath
[src]
impl PartialOrd<SourcePath> for SourcePath
[src]pub fn partial_cmp(&self, other: &SourcePath) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for SourcePath
[src]
impl Serialize for SourcePath
[src]pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
impl Eq for SourcePath
[src]
impl StructuralEq for SourcePath
[src]
impl StructuralPartialEq for SourcePath
[src]
Auto Trait Implementations
impl RefUnwindSafe for SourcePath
impl Send for SourcePath
impl Sync for SourcePath
impl Unpin for SourcePath
impl UnwindSafe for SourcePath
Blanket Implementations
impl<T> CallHasher for T where
T: Hash,
[src]
impl<T> CallHasher for T where
T: Hash,
[src]impl<T> DowncastSync for T where
T: Any + Send + Sync,
[src]
impl<T> DowncastSync for T where
T: Any + Send + Sync,
[src]impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> Serialize for T where
T: Serialize + ?Sized,
[src]
impl<T> Serialize for T where
T: Serialize + ?Sized,
[src]pub fn erased_serialize(
&self,
serializer: &mut dyn Serializer
) -> Result<Ok, Error>
[src]
&self,
serializer: &mut dyn Serializer
) -> Result<Ok, Error>
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<C> ComponentSend for C where
C: Component + Send,
[src]
C: Component + Send,
impl<C> ComponentThreadLocal for C where
C: Component,
[src]
C: Component,
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,