Struct camino::FromPathError
source · [−]pub struct FromPathError(_);
Expand description
A possible error value while converting a Path
to a Utf8Path
.
Produced by the TryFrom<&Path>
implementation for &Utf8Path
.
Examples
use camino::{Utf8Path, FromPathError};
use std::convert::{TryFrom, TryInto};
use std::ffi::OsStr;
use std::os::unix::ffi::OsStrExt;
use std::path::Path;
let unicode_path = Path::new("/valid/unicode");
let utf8_path: &Utf8Path = 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 = Path::new(non_unicode_str);
let err: FromPathError = <&Utf8Path>::try_from(non_unicode_path)
.expect_err("non-Unicode path failed");
Trait Implementations
sourceimpl Clone for FromPathError
impl Clone for FromPathError
sourcefn clone(&self) -> FromPathError
fn clone(&self) -> FromPathError
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for FromPathError
impl Debug for FromPathError
sourceimpl Display for FromPathError
impl Display for FromPathError
sourceimpl Error for FromPathError
impl Error for FromPathError
sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
sourceimpl PartialEq<FromPathError> for FromPathError
impl PartialEq<FromPathError> for FromPathError
sourcefn eq(&self, other: &FromPathError) -> bool
fn eq(&self, other: &FromPathError) -> bool
impl Copy for FromPathError
impl Eq for FromPathError
impl StructuralEq for FromPathError
impl StructuralPartialEq for FromPathError
Auto Trait Implementations
impl RefUnwindSafe for FromPathError
impl Send for FromPathError
impl Sync for FromPathError
impl Unpin for FromPathError
impl UnwindSafe for FromPathError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more