pub struct NullOnErr;Expand description
Marker type for Result<T, ()> that converts Err(()) to NULL.
This type is used internally by the #[miniextendr] macro when handling
Result<T, ()> return types. When the error type is (), there’s no
error message to report, so we return NULL instead of raising an error.
§Usage
You typically don’t use this directly. When you write:
ⓘ
#[miniextendr]
fn maybe_value(x: i32) -> Result<i32, ()> {
if x > 0 { Ok(x) } else { Err(()) }
}The macro generates code that converts Err(()) to Err(NullOnErr) and
returns NULL in R.
§Note
NullOnErr intentionally does NOT implement Display to avoid conflicting
with the generic IntoR for Result<T, E: Display> impl. It has its own
specialized IntoR impl that returns NULL on error.
Trait Implementations§
impl Copy for NullOnErr
impl Eq for NullOnErr
impl StructuralPartialEq for NullOnErr
Auto Trait Implementations§
impl Freeze for NullOnErr
impl RefUnwindSafe for NullOnErr
impl Send for NullOnErr
impl Sync for NullOnErr
impl Unpin for NullOnErr
impl UnsafeUnpin for NullOnErr
impl UnwindSafe for NullOnErr
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