pub struct NumericError {
number: isize,
}
Expand description
An error that is expressed as a negative number
Ideally, that constraint should be expressed in the type system to allow the compiler to
represent Result<positive_usize, NumericError>
as just the isize it originally was. For the
time being, this works well enough, and performance evaluation can later be done against a
manually implemented newtype around isize that’d be used to represent the Result.
Fields§
§number: isize
Implementations§
source§impl NumericError
impl NumericError
sourcepub const fn from_constant(name: isize) -> Self
pub const fn from_constant(name: isize) -> Self
Construct a NumericError from a riot_sys constant
As error constants are in their unsigned positive form, this flips the argument’s sign into the negative range.
let err = NumericError::from_constant(riot_sys::ENOTSUP as _);
println!("{:?}", err); // NumericError { number: -61 }
§Panics
In debug mode, this ensures that the given error is greater than zero.
sourcepub fn again_is_wouldblock(self) -> Error<Self>
pub fn again_is_wouldblock(self) -> Error<Self>
Convert the error into an nb::Error that is nb::Error::WouldBlock if the error is
-EAGAIN
, and an actual error otherwise.
Trait Implementations§
source§impl Debug for NumericError
impl Debug for NumericError
source§impl Error for NumericError
Available on riot_module_sock_udp
and riot_module_sock_aux_local
and crate feature with_embedded_nal_async
only.
impl Error for NumericError
riot_module_sock_udp
and riot_module_sock_aux_local
and crate feature with_embedded_nal_async
only.source§impl From<NameContainsIllegalNull> for NumericError
Available on riot_module_vfs
only.
impl From<NameContainsIllegalNull> for NumericError
riot_module_vfs
only.source§fn from(_: NameContainsIllegalNull) -> NumericError
fn from(_: NameContainsIllegalNull) -> NumericError
source§impl From<NameTooLong> for NumericError
Available on riot_module_vfs
only.
impl From<NameTooLong> for NumericError
riot_module_vfs
only.source§fn from(_: NameTooLong) -> NumericError
fn from(_: NameTooLong) -> NumericError
source§impl From<NumericError> for Error
Available on riot_module_periph_i2c
only.
impl From<NumericError> for Error
riot_module_periph_i2c
only.source§fn from(err: NumericError) -> Self
fn from(err: NumericError) -> Self
source§impl From<NumericError> for Error
Available on riot_module_gcoap
only.
impl From<NumericError> for Error
riot_module_gcoap
only.source§fn from(e: NumericError) -> Error
fn from(e: NumericError) -> Error
source§impl From<NumericError> for Error
Available on riot_module_bluetil_ad
only.
impl From<NumericError> for Error
riot_module_bluetil_ad
only.source§fn from(e: NumericError) -> Error
fn from(e: NumericError) -> Error
source§impl PartialEq for NumericError
impl PartialEq for NumericError
impl Eq for NumericError
impl StructuralPartialEq for NumericError
Auto Trait Implementations§
impl Freeze for NumericError
impl RefUnwindSafe for NumericError
impl Send for NumericError
impl Sync for NumericError
impl Unpin for NumericError
impl UnwindSafe for NumericError
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
source§impl<T> IntoSwitch for T
impl<T> IntoSwitch for T
source§fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>
fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>
source§fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>where
Self: Sized,
fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>where
Self: Sized,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 4 bytes