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