pub struct SDKResult<T>(pub Result<T, WootingAnalogResult>);
Tuple Fields§
§0: Result<T, WootingAnalogResult>
Methods from Deref<Target = Result<T, WootingAnalogResult>>§
1.0.0 · Sourcepub fn as_ref(&self) -> Result<&T, &E>
pub fn as_ref(&self) -> Result<&T, &E>
Converts from &Result<T, E>
to Result<&T, &E>
.
Produces a new Result
, containing a reference
into the original, leaving the original in place.
§Examples
let x: Result<u32, &str> = Ok(2);
assert_eq!(x.as_ref(), Ok(&2));
let x: Result<u32, &str> = Err("Error");
assert_eq!(x.as_ref(), Err(&"Error"));
1.47.0 · Sourcepub fn as_deref(&self) -> Result<&<T as Deref>::Target, &E>where
T: Deref,
pub fn as_deref(&self) -> Result<&<T as Deref>::Target, &E>where
T: Deref,
Converts from Result<T, E>
(or &Result<T, E>
) to Result<&<T as Deref>::Target, &E>
.
Coerces the Ok
variant of the original Result
via Deref
and returns the new Result
.
§Examples
let x: Result<String, u32> = Ok("hello".to_string());
let y: Result<&str, &u32> = Ok("hello");
assert_eq!(x.as_deref(), y);
let x: Result<String, u32> = Err(42);
let y: Result<&str, &u32> = Err(&42);
assert_eq!(x.as_deref(), y);
1.0.0 · Sourcepub fn iter(&self) -> Iter<'_, T>
pub fn iter(&self) -> Iter<'_, T>
Returns an iterator over the possibly contained value.
The iterator yields one value if the result is Result::Ok
, otherwise none.
§Examples
let x: Result<u32, &str> = Ok(7);
assert_eq!(x.iter().next(), Some(&7));
let x: Result<u32, &str> = Err("nothing!");
assert_eq!(x.iter().next(), None);
Trait Implementations§
Source§impl<T> From<Result<T, WootingAnalogResult>> for SDKResult<T>
impl<T> From<Result<T, WootingAnalogResult>> for SDKResult<T>
Source§fn from(ptr: Result<T, WootingAnalogResult>) -> Self
fn from(ptr: Result<T, WootingAnalogResult>) -> Self
Converts to this type from the input type.
Source§impl From<WootingAnalogResult> for SDKResult<()>
impl From<WootingAnalogResult> for SDKResult<()>
Source§fn from(res: WootingAnalogResult) -> Self
fn from(res: WootingAnalogResult) -> Self
Converts to this type from the input type.
Source§impl<T> Into<Result<T, WootingAnalogResult>> for SDKResult<T>
impl<T> Into<Result<T, WootingAnalogResult>> for SDKResult<T>
Source§fn into(self) -> Result<T, WootingAnalogResult>
fn into(self) -> Result<T, WootingAnalogResult>
Converts this type into the (usually inferred) input type.
Source§impl Into<WootingAnalogResult> for SDKResult<()>
impl Into<WootingAnalogResult> for SDKResult<()>
Source§fn into(self) -> WootingAnalogResult
fn into(self) -> WootingAnalogResult
Converts this type into the (usually inferred) input type.
Auto Trait Implementations§
impl<T> Freeze for SDKResult<T>where
T: Freeze,
impl<T> RefUnwindSafe for SDKResult<T>where
T: RefUnwindSafe,
impl<T> Send for SDKResult<T>where
T: Send,
impl<T> Sync for SDKResult<T>where
T: Sync,
impl<T> Unpin for SDKResult<T>where
T: Unpin,
impl<T> UnwindSafe for SDKResult<T>where
T: UnwindSafe,
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