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");
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<FromPathError> for FromPathError
impl PartialEq<FromPathError> 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 ==
.