#[repr(C)]pub struct ResultCode { /* private fields */ }
Expand description
Represents a (raw) result value used all over the OS
These are referred as Result
on docs/official code, but we intentionally name it as ResultCode
to distinguish it from the Result
enum type
Results are often displayed/shown, for example, like 2168-0002
, which corresponds to <2000 + module>-<description>
[Debug
][fmt::Debug
] formatting formats the results as a hex-value (0x4A8
), while [Display
][fmt::Display
] formatting formats the result in the format described above (2168-0002
)
Implementations§
Source§impl ResultCode
impl ResultCode
Sourcepub const fn new_err<T>(value: u32) -> Result<T>
pub const fn new_err<T>(value: u32) -> Result<T>
Wrapper for creating a new [Result::Err
] value with the following raw result
§Arguments
value
: The raw value, note that it mustn’t be0
/success (that would be undefined behavior)
Sourcepub const fn is_success(&self) -> bool
pub const fn is_success(&self) -> bool
Returns whether the ResultCode
is successful
A result value of 0
is a successful value, this essentially checks that
Sourcepub const fn is_failure(&self) -> bool
pub const fn is_failure(&self) -> bool
Returns whether the ResultCode
is not successful
This is the exact opposite of is_success
Sourcepub const fn get_value(&self) -> u32
pub const fn get_value(&self) -> u32
Gets the raw value of the ResultCode
Sourcepub const fn get_module(&self) -> u32
pub const fn get_module(&self) -> u32
Gets the module of the ResultCode
Sourcepub const fn get_description(&self) -> u32
pub const fn get_description(&self) -> u32
Gets the description of the ResultCode
Trait Implementations§
Source§impl Clone for ResultCode
impl Clone for ResultCode
Source§fn clone(&self) -> ResultCode
fn clone(&self) -> ResultCode
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ResultCode
impl Debug for ResultCode
Source§impl Default for ResultCode
impl Default for ResultCode
Source§fn default() -> ResultCode
fn default() -> ResultCode
Source§impl Display for ResultCode
impl Display for ResultCode
Source§impl From<AllocError> for ResultCode
impl From<AllocError> for ResultCode
Source§impl PartialEq for ResultCode
impl PartialEq for ResultCode
Source§impl RequestCommandParameter<ResultCode> for ResultCode
impl RequestCommandParameter<ResultCode> for ResultCode
fn after_request_read(ctx: &mut ServerContext<'_>) -> Result<Self>
Source§impl RequestCommandParameter for ResultCode
impl RequestCommandParameter for ResultCode
fn before_request_write( _raw: &Self, walker: &mut DataWalker, ctx: &mut CommandContext, ) -> Result<()>
fn before_send_sync_request( raw: &Self, walker: &mut DataWalker, ctx: &mut CommandContext, ) -> Result<()>
Source§impl ResponseCommandParameter<ResultCode> for ResultCode
impl ResponseCommandParameter<ResultCode> for ResultCode
fn after_response_read( walker: &mut DataWalker, ctx: &mut CommandContext, ) -> Result<Self>
Source§impl ResponseCommandParameter for ResultCode
impl ResponseCommandParameter for ResultCode
type CarryState = ()
fn before_response_write( _raw: &Self, ctx: &mut ServerContext<'_>, ) -> Result<Self::CarryState>
fn after_response_write( raw: Self, _carry_state: Self::CarryState, ctx: &mut ServerContext<'_>, ) -> Result<()>
impl 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
§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)
clone_to_uninit
)