Struct cluFlock::err::FlockError
source · [−]pub struct FlockError<T> where
T: FlockElement, { /* private fields */ }
Expand description
The standard error for Flock methods, from the error you can get a borrowed value.
Implementations
sourceimpl<T> FlockError<T> where
T: FlockElement,
impl<T> FlockError<T> where
T: FlockElement,
pub fn new(a: T, err: Error) -> Self
pub fn get_debug_data(&self) -> &impl Debug where
T: Debug,
pub fn get_debug_err(&self) -> &impl Debug
pub fn is_would_block(&self) -> bool
sourcepub fn is_already_lock(&self) -> bool
pub fn is_already_lock(&self) -> bool
The error occurred due to the presence of a lock.
Methods from Deref<Target = Error>
1.0.0 · sourcepub fn raw_os_error(&self) -> Option<i32>
pub fn raw_os_error(&self) -> Option<i32>
Returns the OS error that this error represents (if any).
If this Error
was constructed via last_os_error
or
from_raw_os_error
, then this function will return Some
, otherwise
it will return None
.
Examples
use std::io::{Error, ErrorKind};
fn print_os_error(err: &Error) {
if let Some(raw_os_err) = err.raw_os_error() {
println!("raw OS error: {:?}", raw_os_err);
} else {
println!("Not an OS error");
}
}
fn main() {
// Will print "raw OS error: ...".
print_os_error(&Error::last_os_error());
// Will print "Not an OS error".
print_os_error(&Error::new(ErrorKind::Other, "oh no!"));
}
1.3.0 · sourcepub fn get_ref(&self) -> Option<&(dyn Error + Sync + Send + 'static)>
pub fn get_ref(&self) -> Option<&(dyn Error + Sync + Send + 'static)>
Returns a reference to the inner error wrapped by this error (if any).
If this Error
was constructed via new
then this function will
return Some
, otherwise it will return None
.
Examples
use std::io::{Error, ErrorKind};
fn print_error(err: &Error) {
if let Some(inner_err) = err.get_ref() {
println!("Inner error: {:?}", inner_err);
} else {
println!("No inner error");
}
}
fn main() {
// Will print "No inner error".
print_error(&Error::last_os_error());
// Will print "Inner error: ...".
print_error(&Error::new(ErrorKind::Other, "oh no!"));
}
1.0.0 · sourcepub fn kind(&self) -> ErrorKind
pub fn kind(&self) -> ErrorKind
Returns the corresponding ErrorKind
for this error.
Examples
use std::io::{Error, ErrorKind};
fn print_error(err: Error) {
println!("{:?}", err.kind());
}
fn main() {
// Will print "Uncategorized".
print_error(Error::last_os_error());
// Will print "AddrInUse".
print_error(Error::new(ErrorKind::AddrInUse, "oh no!"));
}
Trait Implementations
sourceimpl<T> Debug for FlockError<T> where
T: FlockElement,
impl<T> Debug for FlockError<T> where
T: FlockElement,
sourceimpl<T> Deref for FlockError<T> where
T: FlockElement,
impl<T> Deref for FlockError<T> where
T: FlockElement,
sourceimpl<T> Display for FlockError<T> where
T: FlockElement,
impl<T> Display for FlockError<T> where
T: FlockElement,
sourceimpl<T> Error for FlockError<T> where
T: FlockElement,
impl<T> Error for FlockError<T> where
T: FlockElement,
sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn description(&self) -> &str
fn description(&self) -> &str
👎 Deprecated since 1.42.0:
use the Display impl or to_string()
sourceimpl<T> From<(T, Error)> for FlockError<T> where
T: FlockElement,
impl<T> From<(T, Error)> for FlockError<T> where
T: FlockElement,
sourceimpl<T> From<FlockError<T>> for Error where
T: FlockElement,
impl<T> From<FlockError<T>> for Error where
T: FlockElement,
sourcefn from(a: FlockError<T>) -> Error
fn from(a: FlockError<T>) -> Error
Performs the conversion.
Auto Trait Implementations
impl<T> RefUnwindSafe for FlockError<T> where
T: RefUnwindSafe,
impl<T> Send for FlockError<T> where
T: Send,
impl<T> Sync for FlockError<T> where
T: Sync,
impl<T> Unpin for FlockError<T> where
T: Unpin,
impl<T> UnwindSafe for FlockError<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more