pub struct FromPathError(/* private fields */);
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");
Implementations§
Source§impl FromPathError
impl FromPathError
Sourcepub fn into_io_error(self) -> Error
pub fn into_io_error(self) -> Error
Converts self into a std::io::Error
with kind
InvalidData
.
Many users of FromPathError
will want to convert it into an io::Error
. This is a
convenience method to do that.
Trait Implementations§
Source§impl Clone for FromPathError
impl Clone for FromPathError
Source§fn clone(&self) -> FromPathError
fn clone(&self) -> FromPathError
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for FromPathError
impl Debug for FromPathError
Source§impl Display for FromPathError
impl Display for FromPathError
Source§impl Error for FromPathError
impl Error for FromPathError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl PartialEq for FromPathError
impl PartialEq for FromPathError
impl Copy for FromPathError
impl Eq for FromPathError
impl StructuralPartialEq for FromPathError
Auto Trait Implementations§
impl Freeze for FromPathError
impl RefUnwindSafe for FromPathError
impl Send for FromPathError
impl Sync for FromPathError
impl Unpin for FromPathError
impl UnwindSafe for FromPathError
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)