Struct CilPrimitive
pub struct CilPrimitive {
pub kind: CilPrimitiveKind,
pub data: CilPrimitiveData,
}Expand description
Represents all primitive types in CIL/.NET with optional data
Fields§
§kind: CilPrimitiveKindThe type of primitive
data: CilPrimitiveDataThe actual data (if available)
Implementations§
§impl CilPrimitive
impl CilPrimitive
pub fn new(kind: CilPrimitiveKind) -> Self
pub fn new(kind: CilPrimitiveKind) -> Self
pub fn with_data(kind: CilPrimitiveKind, data: CilPrimitiveData) -> Self
pub fn with_data(kind: CilPrimitiveKind, data: CilPrimitiveData) -> Self
Create a primitive with specific data
§Arguments
kind- Set the kind of primitivedata- Set the data for the primitive
pub fn null() -> Self
pub fn null() -> Self
Create a null primitive
pub fn from_byte(byte: u8) -> Result<Self>
pub fn from_byte(byte: u8) -> Result<Self>
Try to parse a primitive type from a signature byte
§Arguments
byte- The kind byte to convert
§Errors
Returns TypeNotPrimitive if the byte does not represent a valid primitive type.
pub fn clr_full_name(&self) -> &'static str
pub fn clr_full_name(&self) -> &'static str
Get the CLR full type name (with namespace)
pub fn is_value_type(&self) -> bool
pub fn is_value_type(&self) -> bool
Is this a value type
pub fn is_reference_type(&self) -> bool
pub fn is_reference_type(&self) -> bool
Is this a reference type
pub fn from_blob(p_type: u8, blob: &[u8]) -> Result<Self>
pub fn from_blob(p_type: u8, blob: &[u8]) -> Result<Self>
Parse a primitive value from a blob of data
§Arguments
p_type- The primitive byte to determine the kind ofblob- The data blob to parse for the value
§Errors
Returns TypeNotPrimitive if the primitive type is invalid.
Returns OutOfBounds or other errors if the blob data is insufficient or invalid.
pub fn as_boolean(&self) -> Option<bool>
pub fn as_boolean(&self) -> Option<bool>
Try to get as boolean value
Trait Implementations§
§impl Clone for CilPrimitive
impl Clone for CilPrimitive
§fn clone(&self) -> CilPrimitive
fn clone(&self) -> CilPrimitive
Returns a duplicate 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 more§impl Debug for CilPrimitive
impl Debug for CilPrimitive
§impl Display for CilPrimitive
impl Display for CilPrimitive
§impl From<&str> for CilPrimitive
impl From<&str> for CilPrimitive
§impl From<CilPrimitive> for CilFlavor
impl From<CilPrimitive> for CilFlavor
§fn from(primitive: CilPrimitive) -> Self
fn from(primitive: CilPrimitive) -> Self
Converts to this type from the input type.
§impl From<String> for CilPrimitive
impl From<String> for CilPrimitive
§impl From<bool> for CilPrimitive
impl From<bool> for CilPrimitive
§impl From<char> for CilPrimitive
impl From<char> for CilPrimitive
§impl From<f32> for CilPrimitive
impl From<f32> for CilPrimitive
§impl From<f64> for CilPrimitive
impl From<f64> for CilPrimitive
§impl From<i16> for CilPrimitive
impl From<i16> for CilPrimitive
§impl From<i32> for CilPrimitive
impl From<i32> for CilPrimitive
§impl From<i64> for CilPrimitive
impl From<i64> for CilPrimitive
§impl From<i8> for CilPrimitive
impl From<i8> for CilPrimitive
§impl From<u16> for CilPrimitive
impl From<u16> for CilPrimitive
§impl From<u32> for CilPrimitive
impl From<u32> for CilPrimitive
§impl From<u64> for CilPrimitive
impl From<u64> for CilPrimitive
§impl From<u8> for CilPrimitive
impl From<u8> for CilPrimitive
§impl PartialEq for CilPrimitive
impl PartialEq for CilPrimitive
§impl TryFrom<CilFlavor> for CilPrimitive
impl TryFrom<CilFlavor> for CilPrimitive
§impl TryFrom<CilPrimitive> for String
impl TryFrom<CilPrimitive> for String
§impl TryFrom<CilPrimitive> for bool
impl TryFrom<CilPrimitive> for bool
§impl TryFrom<CilPrimitive> for f64
impl TryFrom<CilPrimitive> for f64
§impl TryFrom<CilPrimitive> for i32
impl TryFrom<CilPrimitive> for i32
§impl TryFrom<CilPrimitive> for i64
impl TryFrom<CilPrimitive> for i64
impl StructuralPartialEq for CilPrimitive
Auto Trait Implementations§
impl Freeze for CilPrimitive
impl RefUnwindSafe for CilPrimitive
impl Send for CilPrimitive
impl Sync for CilPrimitive
impl Unpin for CilPrimitive
impl UnwindSafe for CilPrimitive
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more