pub struct FromBoxedPathError { /* private fields */ }Expand description
A possible error value while converting a Box<Path> to a Box<Utf8Path>.
Produced by the TryFrom<Box<Path>> implementation for Box<Utf8Path>.
§Examples
use camino::{Utf8Path, FromBoxedPathError};
use std::convert::{TryFrom, TryInto};
use std::ffi::OsStr;
use std::os::unix::ffi::OsStrExt;
use std::path::Path;
let unicode_path: Box<Path> = Path::new("/valid/unicode").into();
let utf8_path: Box<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: Box<Path> = Path::new(non_unicode_str).into();
let err: FromBoxedPathError = <Box<Utf8Path>>::try_from(non_unicode_path.clone())
.expect_err("non-Unicode path failed");
assert_eq!(err.as_path(), &*non_unicode_path);
assert_eq!(err.into_boxed_path(), non_unicode_path);Implementations§
Source§impl FromBoxedPathError
impl FromBoxedPathError
Sourcepub fn as_path(&self) -> &Path
pub fn as_path(&self) -> &Path
Returns the Path slice that was attempted to be converted to Box<Utf8Path>.
Sourcepub fn into_boxed_path(self) -> Box<Path>
pub fn into_boxed_path(self) -> Box<Path>
Returns the Box<Path> that was attempted to be converted to Box<Utf8Path>.
Sourcepub fn from_path_error(&self) -> FromPathError
pub fn from_path_error(&self) -> FromPathError
Fetches a FromPathError for more about the conversion failure.
At the moment this struct does not contain any additional information, but is provided for completeness.
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 FromBoxedPathError will want to convert it into an io::Error. This is a
convenience method to do that.
Trait Implementations§
Source§impl Clone for FromBoxedPathError
impl Clone for FromBoxedPathError
Source§fn clone(&self) -> FromBoxedPathError
fn clone(&self) -> FromBoxedPathError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 FromBoxedPathError
impl Debug for FromBoxedPathError
Source§impl Display for FromBoxedPathError
impl Display for FromBoxedPathError
Source§impl Error for FromBoxedPathError
impl Error for FromBoxedPathError
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 FromBoxedPathError
impl PartialEq for FromBoxedPathError
Source§fn eq(&self, other: &FromBoxedPathError) -> bool
fn eq(&self, other: &FromBoxedPathError) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for FromBoxedPathError
impl StructuralPartialEq for FromBoxedPathError
Auto Trait Implementations§
impl Freeze for FromBoxedPathError
impl RefUnwindSafe for FromBoxedPathError
impl Send for FromBoxedPathError
impl Sync for FromBoxedPathError
impl Unpin for FromBoxedPathError
impl UnsafeUnpin for FromBoxedPathError
impl UnwindSafe for FromBoxedPathError
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