[−][src]Struct mutiny::components::SourcePath
Methods from Deref<Target = PathBuf>
pub fn as_path(&self) -> &Path
1.0.0[src]
pub fn as_path(&self) -> &Path
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]
pub fn push<P>(&mut self, path: P) where
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]
pub fn pop(&mut self) -> bool
Truncates self
to self.parent
.
Returns false
and does nothing if self.file_name
is None
.
Otherwise, returns true
.
Examples
use std::path::{Path, PathBuf}; let mut p = PathBuf::from("/test/test.rs"); p.pop(); assert_eq!(Path::new("/test"), 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]
pub fn set_file_name<S>(&mut self, file_name: S) where
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]
pub fn set_extension<S>(&mut self, extension: S) -> bool where
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());
Trait Implementations
impl PartialOrd<SourcePath> for SourcePath
[src]
impl PartialOrd<SourcePath> for SourcePath
fn partial_cmp(&self, other: &SourcePath) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &SourcePath) -> Option<Ordering>
fn lt(&self, other: &SourcePath) -> bool
[src]
fn lt(&self, other: &SourcePath) -> bool
fn le(&self, other: &SourcePath) -> bool
[src]
fn le(&self, other: &SourcePath) -> bool
fn gt(&self, other: &SourcePath) -> bool
[src]
fn gt(&self, other: &SourcePath) -> bool
fn ge(&self, other: &SourcePath) -> bool
[src]
fn ge(&self, other: &SourcePath) -> bool
impl Ord for SourcePath
[src]
impl Ord for SourcePath
fn cmp(&self, other: &SourcePath) -> Ordering
[src]
fn cmp(&self, other: &SourcePath) -> Ordering
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl PartialEq<SourcePath> for SourcePath
[src]
impl PartialEq<SourcePath> for SourcePath
fn eq(&self, other: &SourcePath) -> bool
[src]
fn eq(&self, other: &SourcePath) -> bool
fn ne(&self, other: &SourcePath) -> bool
[src]
fn ne(&self, other: &SourcePath) -> bool
impl Clone for SourcePath
[src]
impl Clone for SourcePath
fn clone(&self) -> SourcePath
[src]
fn clone(&self) -> SourcePath
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Eq for SourcePath
[src]
impl Eq for SourcePath
impl Debug for SourcePath
[src]
impl Debug for SourcePath
impl Hash for SourcePath
[src]
impl Hash for SourcePath
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Deref for SourcePath
[src]
impl Deref for SourcePath
impl DerefMut for SourcePath
[src]
impl DerefMut for SourcePath
impl Component for SourcePath
[src]
impl Component for SourcePath
impl<'a> DebugParameter for SourcePath
[src]
impl<'a> DebugParameter for SourcePath
fn debug<S: Serializer>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
[src]
fn debug<S: Serializer>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
impl Serialize for SourcePath
[src]
impl Serialize for SourcePath
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
impl<'de> Deserialize<'de> for SourcePath
[src]
impl<'de> Deserialize<'de> for SourcePath
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Auto Trait Implementations
impl Send for SourcePath
impl Send for SourcePath
impl Sync for SourcePath
impl Sync for SourcePath
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
impl<C> ComponentSend for C where
C: Component + Send,
[src]
impl<C> ComponentSend for C where
C: Component + Send,
impl<C> ComponentThreadLocal for C where
C: Component,
[src]
impl<C> ComponentThreadLocal for C where
C: Component,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
impl<T> Serialize for T where
T: Serialize + ?Sized,
[src]
impl<T> Serialize for T where
T: Serialize + ?Sized,
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
[src]
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
impl<T> Any for T where
T: Any,
[src]
impl<T> Any for T where
T: Any,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T> SetParameter for T
[src]
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
[src]
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
Sets value
as a parameter of self
.
impl<T> Same for T
[src]
impl<T> Same for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
[src]
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
[src]
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
[src]
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
[src]
fn from_subset(element: &SS) -> SP
impl<V> IntoVec for V
[src]
impl<V> IntoVec for V
impl<V> IntoPnt for V
[src]
impl<V> IntoPnt for V
impl<B, P> IntoControlBuilder for P where
B: BuilderFromProperty<P>,
[src]
impl<B, P> IntoControlBuilder for P where
B: BuilderFromProperty<P>,
fn into_builder<S>(self, name: &str, events: S) -> B where
S: Stream<'static, Event>,
[src]
fn into_builder<S>(self, name: &str, events: S) -> B where
S: Stream<'static, Event>,
impl<T, U> IntoDuration for T where
U: FromDuration<T>,
[src]
impl<T, U> IntoDuration for T where
U: FromDuration<T>,
type Error = <U as FromDuration<T>>::Error
fn into_duration(self) -> Result<U, <U as FromDuration<T>>::Error>
[src]
fn into_duration(self) -> Result<U, <U as FromDuration<T>>::Error>