Struct ctru::error::ResultCode
source · #[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: Result
Trait Implementations§
source§impl Clone for ResultCode
impl Clone for ResultCode
source§fn clone(&self) -> ResultCode
fn clone(&self) -> ResultCode
Returns a copy 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§impl Try for ResultCode
impl Try for ResultCode
§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.§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 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