Struct CilType

pub struct CilType {
Show 20 fields pub token: Token, pub namespace: String, pub name: String, pub external: Option<CilTypeReference>, pub flags: u32, pub fields: FieldList, pub methods: MethodRefList, pub properties: PropertyList, pub events: EventList, pub interfaces: CilTypeRefList, pub overwrites: Arc<Vec<CilTypeReference>>, pub nested_types: CilTypeRefList, pub generic_params: GenericParamList, pub generic_args: MethodSpecList, pub custom_attributes: CustomAttributeValueList, pub packing_size: OnceLock<u16>, pub class_size: OnceLock<u32>, pub spec: OnceLock<CilFlavor>, pub modifiers: Arc<Vec<CilModifier>>, pub security: OnceLock<Security>, /* private fields */
}
Expand description

Represents a ‘Type’, close to TypeDef and TypeRef but as a combined item, containing more information. The Token will match either the TypeDef or TypeRef or TypeSpec or TypeBase (artificial, for mapping to specific primitive types supported in the runtime).

Fields§

§token: Token

Token

§namespace: String

TypeNamespace (can be empty, e.g. for artificial <module> (globals) )

§name: String

TypeName

§external: Option<CilTypeReference>

Type is imported (e.g. AssemblyRef, File, ModuleRef, …)

§flags: u32

Flags (a 4-byte bitmask of type TypeAttributes, §II.23.1.15)

§fields: FieldList

All fields this type has

§methods: MethodRefList

All methods this type has

§properties: PropertyList

All properties this type has

§events: EventList

All events this type has

§interfaces: CilTypeRefList

All interfaces this class implements

§overwrites: Arc<Vec<CilTypeReference>>

All method overwrites this type implements (e.g. Interfaces)

§nested_types: CilTypeRefList

All types that are ‘contained’ in this type

§generic_params: GenericParamList

All generic parameters this type has (type information, not the instantiated version)

§generic_args: MethodSpecList

All generic arguments this type has (instantiated version)

§custom_attributes: CustomAttributeValueList

All custom attributes this type has

§packing_size: OnceLock<u16>

a 2-byte value, specifying the alignment of fields

§class_size: OnceLock<u32>

a 4-byte value, specifying the size of the class

§spec: OnceLock<CilFlavor>

TypeSpec specifiers for the type

§modifiers: Arc<Vec<CilModifier>>

Type modifiers from TypeSpec for this type

§security: OnceLock<Security>

The .NET CIL Security Information (if present)

Implementations§

§

impl CilType

pub fn new( token: Token, namespace: String, name: String, external: Option<CilTypeReference>, base: Option<CilTypeRef>, flags: u32, fields: FieldList, methods: MethodRefList, flavor: Option<CilFlavor>, ) -> Self

Create a new instance of a CilType

§Arguments
  • token - The token for this type
  • namespace - The namespace of the type
  • name - The name of the type
  • external - External type reference if this is an imported type
  • base - Base type reference if this type inherits from another
  • flags - Type attributes flags
  • fields - Fields belonging to this type
  • methods - Methods belonging to this type
  • flavor - Optional explicit flavor. If None, flavor will be computed lazily

pub fn set_base(&self, base_type: CilTypeRef) -> Result<(), CilTypeRef>

Set the base type of this type (for interface inheritance)

§Errors

Returns Err(base_type) if a base type was already set for this type. The error contains the base_type that was attempted to be set.

§Returns

Ok(()) if the base type was set successfully.

pub fn base(&self) -> Option<CilTypeRc>

Access the base type of this type, if it exists

pub fn flavor(&self) -> &CilFlavor

Get the computed type flavor - determined lazily from context

pub fn fullname(&self) -> String

Returns the full name (Namespace.Name) of the entity

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.