#[repr(transparent)]pub struct CRIME_TYPE_CEnum(pub u32);
Expand description
Auto-generated FFI type for CRIME_TYPE
.
§When use this?
C’s enum is really just a number and there is no guarantee that it will fit within the enum. Therefore, it is used for the following cases that cannot be controlled by Rust.
- C++ members
- Function return values.
§When not to use it?
Mainly those that can be controlled for safety on the Rust side.
- Function Arguments
§Convenient methods
to_enum
/from_enum
: To inter-convert enums.count
: Returns the number of defined discriminants.
§Memory Layout
It will always have #[repr(transparent)]
.
In other words, it is equivalent to the size specified in repr
.
Tuple Fields§
§0: u32
Implementations§
Source§impl CRIME_TYPE_CEnum
impl CRIME_TYPE_CEnum
pub const Steal: Self
pub const Pickpocket: Self
pub const Trespass: Self
pub const Attack: Self
pub const Murder: Self
pub const Escape: Self
pub const Unused: Self
Sourcepub const fn to_enum(self) -> Option<CRIME_TYPE>
pub const fn to_enum(self) -> Option<CRIME_TYPE>
Converts to the corresponding enum
variant.
Returns Some(CRIME_TYPE)
if the value is valid, otherwise None
.
Sourcepub const fn from_enum(e: CRIME_TYPE) -> Self
pub const fn from_enum(e: CRIME_TYPE) -> Self
Creates the struct from the enum
.
This allows for easy conversion back to the FFI-friendly representation.
Trait Implementations§
Source§impl Clone for CRIME_TYPE_CEnum
impl Clone for CRIME_TYPE_CEnum
Source§fn clone(&self) -> CRIME_TYPE_CEnum
fn clone(&self) -> CRIME_TYPE_CEnum
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for CRIME_TYPE_CEnum
impl Debug for CRIME_TYPE_CEnum
Source§impl Default for CRIME_TYPE_CEnum
impl Default for CRIME_TYPE_CEnum
Source§impl From<CRIME_TYPE> for CRIME_TYPE_CEnum
impl From<CRIME_TYPE> for CRIME_TYPE_CEnum
Source§fn from(value: CRIME_TYPE) -> Self
fn from(value: CRIME_TYPE) -> Self
Converts to this type from the input type.
Source§impl Hash for CRIME_TYPE_CEnum
impl Hash for CRIME_TYPE_CEnum
Source§impl Ord for CRIME_TYPE_CEnum
impl Ord for CRIME_TYPE_CEnum
Source§fn cmp(&self, other: &CRIME_TYPE_CEnum) -> Ordering
fn cmp(&self, other: &CRIME_TYPE_CEnum) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for CRIME_TYPE_CEnum
impl PartialEq for CRIME_TYPE_CEnum
Source§impl PartialOrd for CRIME_TYPE_CEnum
impl PartialOrd for CRIME_TYPE_CEnum
Source§impl TryFrom<CRIME_TYPE_CEnum> for CRIME_TYPE
impl TryFrom<CRIME_TYPE_CEnum> for CRIME_TYPE
impl Copy for CRIME_TYPE_CEnum
impl Eq for CRIME_TYPE_CEnum
impl StructuralPartialEq for CRIME_TYPE_CEnum
Auto Trait Implementations§
impl Freeze for CRIME_TYPE_CEnum
impl RefUnwindSafe for CRIME_TYPE_CEnum
impl Send for CRIME_TYPE_CEnum
impl Sync for CRIME_TYPE_CEnum
impl Unpin for CRIME_TYPE_CEnum
impl UnwindSafe for CRIME_TYPE_CEnum
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