Lines Matching defs:crate
9 use crate::{
28 match super::Error::try_from_errno(-(crate::bindings::$err as i32)) {
123 pub fn from_errno(errno: crate::ffi::c_int) -> Error {
128 crate::pr_warn!(
139 const fn try_from_errno(errno: crate::ffi::c_int) -> Option<Error> {
153 const unsafe fn from_errno_unchecked(errno: crate::ffi::c_int) -> Error {
161 pub fn to_errno(self) -> crate::ffi::c_int {
166 pub(crate) fn to_blk_status(self) -> bindings::blk_status_t {
174 unsafe { bindings::ERR_PTR(self.0.get() as crate::ffi::c_long).cast() }
432 pub fn to_result(err: crate::ffi::c_int) -> Result {
462 // CAST: Casting a pointer to `*const crate::ffi::c_void` is always valid.
463 let const_ptr: *const crate::ffi::c_void = ptr.cast();
479 return Err(unsafe { Error::from_errno_unchecked(err as crate::ffi::c_int) });
484 /// Calls a closure returning a [`crate::error::Result<T>`] and converts the result to
487 /// This is useful when calling Rust functions that return [`crate::error::Result<T>`]