Struct camino::FromPathBufError [−][src]
A possible error value while converting a PathBuf
to a Utf8PathBuf
.
Produced by the TryFrom<PathBuf>
implementation for Utf8PathBuf
.
Examples
use camino::{Utf8PathBuf, FromPathBufError}; use std::convert::{TryFrom, TryInto}; use std::ffi::OsStr; use std::os::unix::ffi::OsStrExt; use std::path::PathBuf; let unicode_path = PathBuf::from("/valid/unicode"); let utf8_path_buf: Utf8PathBuf = unicode_path.try_into().expect("valid Unicode path succeeded"); // Paths on Unix can be non-UTF-8. let non_unicode_str = OsStr::from_bytes(b"\xFF\xFF\xFF"); let non_unicode_path = PathBuf::from(non_unicode_str); let err: FromPathBufError = Utf8PathBuf::try_from(non_unicode_path.clone()) .expect_err("non-Unicode path failed"); assert_eq!(err.as_path(), &non_unicode_path); assert_eq!(err.into_path_buf(), non_unicode_path);
Implementations
impl FromPathBufError
[src]
pub fn as_path(&self) -> &Path
[src]
Returns the Path
slice that was attempted to be converted to Utf8PathBuf
.
pub fn into_path_buf(self) -> PathBuf
[src]
Returns the PathBuf
that was attempted to be converted to Utf8PathBuf
.
pub fn from_path_error(&self) -> FromPathError
[src]
Fetch a FromPathError
for more about the conversion failure.
At the moment this struct does not contain any additional information, but is provided for completeness.
Trait Implementations
impl Clone for FromPathBufError
[src]
fn clone(&self) -> FromPathBufError
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for FromPathBufError
[src]
impl Display for FromPathBufError
[src]
impl Eq for FromPathBufError
[src]
impl Error for FromPathBufError
[src]
fn source(&self) -> Option<&(dyn Error + 'static)>
[src]
pub fn backtrace(&self) -> Option<&Backtrace>
[src]
pub fn description(&self) -> &str
1.0.0[src]
pub fn cause(&self) -> Option<&dyn Error>
1.0.0[src]
impl PartialEq<FromPathBufError> for FromPathBufError
[src]
fn eq(&self, other: &FromPathBufError) -> bool
[src]
fn ne(&self, other: &FromPathBufError) -> bool
[src]
impl StructuralEq for FromPathBufError
[src]
impl StructuralPartialEq for FromPathBufError
[src]
Auto Trait Implementations
impl RefUnwindSafe for FromPathBufError
impl Send for FromPathBufError
impl Sync for FromPathBufError
impl Unpin for FromPathBufError
impl UnwindSafe for FromPathBufError
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,