Struct camino::FromPathError
source · 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)>
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
source§fn eq(&self, other: &FromPathError) -> bool
fn eq(&self, other: &FromPathError) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.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