#[repr(transparent)]pub struct ResultCode(pub Result);Expand description
Validity checker of raw ctru_sys::Result codes.
This struct supports the “try” syntax (?) to convert to an Error::Os.
§Example
use ctru::error::{Result, ResultCode};
pub fn main() -> Result<()> {
// We run an unsafe function which returns a `ctru_sys::Result`.
let result: ctru_sys::Result = unsafe { ctru_sys::hidInit() };
// The result code is parsed and any possible error gets returned by the function.
ResultCode(result)?;
Ok(())
}Tuple Fields§
§0: ResultTrait Implementations§
Source§impl Clone for ResultCode
impl Clone for ResultCode
Source§fn clone(&self) -> ResultCode
fn clone(&self) -> ResultCode
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResultCode
impl Debug for ResultCode
Source§impl From<ResultCode> for Error
impl From<ResultCode> for Error
Source§fn from(err: ResultCode) -> Self
fn from(err: ResultCode) -> Self
Converts to this type from the input type.
Source§impl FromResidual for ResultCode
impl FromResidual for ResultCode
Source§fn from_residual(e: <Self as Try>::Residual) -> Self
fn from_residual(e: <Self as Try>::Residual) -> Self
🔬This is a nightly-only experimental API. (
try_trait_v2)Constructs the type from a compatible
Residual type. Read moreSource§impl Ord for ResultCode
impl Ord for ResultCode
Source§impl PartialEq for ResultCode
impl PartialEq for ResultCode
Source§impl PartialOrd for ResultCode
impl PartialOrd for ResultCode
Source§fn partial_cmp(&self, other: &ResultCode) -> Option<Ordering>
fn partial_cmp(&self, other: &ResultCode) -> Option<Ordering>
Source§impl Try for ResultCode
impl Try for ResultCode
Source§type Output = ()
type Output = ()
🔬This is a nightly-only experimental API. (
try_trait_v2)The type of the value produced by
? when not short-circuiting.Source§type Residual = Error
type Residual = Error
🔬This is a nightly-only experimental API. (
try_trait_v2)The type of the value passed to [
FromResidual::from_residual]
as part of ? when short-circuiting. Read moreSource§fn from_output(_: Self::Output) -> Self
fn from_output(_: Self::Output) -> Self
🔬This is a nightly-only experimental API. (
try_trait_v2)Constructs the type from its
Output type. Read moreSource§fn branch(self) -> ControlFlow<Self::Residual, Self::Output>
fn branch(self) -> ControlFlow<Self::Residual, Self::Output>
🔬This is a nightly-only experimental API. (
try_trait_v2)Used in
? to decide whether the operator should produce a value
(because this returned [ControlFlow::Continue])
or propagate a value back to the caller
(because this returned [ControlFlow::Break]). Read moreimpl Copy for ResultCode
impl Eq for ResultCode
impl StructuralPartialEq for ResultCode
Auto Trait Implementations§
impl Freeze for ResultCode
impl RefUnwindSafe for ResultCode
impl Send for ResultCode
impl Sync for ResultCode
impl Unpin for ResultCode
impl UnwindSafe for ResultCode
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)