pub struct LoadError<S: State> { /* private fields */ }
Expand description
Error within Cookie::load()
or Cookie::load_buffers()
This is like cookie:Error
but also has the cookie in its original state.
§Examples
let cookie = magic::Cookie::open(Default::default())?;
let database = "data/tests/db-images-png".try_into()?;
// try to load an existing database, consuming and returning early
let cookie = cookie.load(&database)?;
let database = "doesntexist.mgc".try_into()?;
// load a database that does not exist
let cookie = match cookie.load(&database) {
Err(err) => {
println!("whoopsie: {:?}", err);
// recover the loaded cookie without dropping it
err.cookie()
},
Ok(cookie) => cookie,
};
let database = "data/tests/db-python".try_into()?;
// try to load another existing database
let cookie = cookie.load(&database)?;
Implementations§
Trait Implementations§
source§impl<S: State> Error for LoadError<S>
impl<S: State> Error for LoadError<S>
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()
Auto Trait Implementations§
impl<S> Freeze for LoadError<S>
impl<S> !RefUnwindSafe for LoadError<S>
impl<S> !Send for LoadError<S>
impl<S> !Sync for LoadError<S>
impl<S> Unpin for LoadError<S>where
S: Unpin,
impl<S> !UnwindSafe for LoadError<S>
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