Struct SignatureTypeSpec
pub struct SignatureTypeSpec {
pub base: TypeSignature,
}Expand description
Type specification signature for complex and generic types.
Represents type specification signatures according to ECMA-335 Section II.23.2.14. Type specifications are used to represent complex types that cannot be expressed through simple metadata tokens, particularly generic instantiations and complex nested types.
§Type Specification Uses
§Generic Instantiations
Complex generic types with specific type arguments:
List<int>- Generic class with value type argumentDictionary<string, object>- Generic class with multiple argumentsArray<T>- Generic array with type parameter
§Nested Generic Types
Generic types nested within other generic types:
Outer<T>.Inner<U>- Nested generic classesContainer<T>.Collection<U>.Item<V>- Multiple nesting levels
§Complex Array Types
Multi-dimensional and modified array types:
int[,]- Multi-dimensional arraysvolatile int[]- Arrays with custom modifiersT[][]- Jagged arrays with generic elements
§Function Pointer Types
Complex function pointer signatures:
delegate*<int, string, bool>- Function pointers with multiple parametersdelegate* managed<T, U>- Generic function pointers
§Binary Format (ECMA-335)
Type specifications are encoded as complete type signatures:
TypeSpec ::= TypeWhere Type can be any valid type signature including complex generic instantiations.
§Examples
§Generic Instantiation
use dotscope::metadata::signatures::{SignatureTypeSpec, TypeSignature};
use dotscope::metadata::token::Token;
let list_of_int = SignatureTypeSpec {
base: TypeSignature::GenericInst(
Box::new(TypeSignature::Class(Token::new(0x02000001))), // List<T> class
vec![TypeSignature::I4] // int argument
),
};§Complex Array Type
use dotscope::metadata::signatures::{SignatureTypeSpec, TypeSignature, SignatureArray};
use dotscope::metadata::typesystem::ArrayDimensions;
let int_2d_array = SignatureTypeSpec {
base: TypeSignature::Array(SignatureArray {
base: Box::new(TypeSignature::I4),
rank: 2,
dimensions: vec![
ArrayDimensions { size: None, lower_bound: None },
ArrayDimensions { size: None, lower_bound: None },
],
}),
};§Performance Considerations
- Type specifications are resolved once and cached
- Complex generic instantiations may have resolution overhead
- Runtime type checking enforces specification constraints
§Thread Safety
SignatureTypeSpec is immutable after construction and safe to share between threads.
§ECMA-335 Compliance
This structure implements ECMA-335 Partition II, Section 23.2.14 (TypeSpec) and supports all standard type specification scenarios.
§See Also
TypeSignature: For the underlying type representationSignatureMethodSpec: For method specification signaturescrate::metadata::token::Token: For metadata token references
Fields§
§base: TypeSignatureThe complete type signature for this type specification.
Contains the full type signature that defines this type specification. This can be any valid type signature, but is typically used for complex types that require full signature representation.
§Type Categories
- Generic Instantiations:
List<T>,Dictionary<K,V> - Complex Arrays: Multi-dimensional or modified arrays
- Function Pointers: Complex delegate types
- Nested Types: Generic types within generic types
§Resolution
The type signature is resolved by the runtime to create the actual type representation used during execution.
Trait Implementations§
§impl Clone for SignatureTypeSpec
impl Clone for SignatureTypeSpec
§fn clone(&self) -> SignatureTypeSpec
fn clone(&self) -> SignatureTypeSpec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for SignatureTypeSpec
impl Debug for SignatureTypeSpec
§impl Default for SignatureTypeSpec
impl Default for SignatureTypeSpec
§fn default() -> SignatureTypeSpec
fn default() -> SignatureTypeSpec
§impl PartialEq for SignatureTypeSpec
impl PartialEq for SignatureTypeSpec
impl StructuralPartialEq for SignatureTypeSpec
Auto Trait Implementations§
impl Freeze for SignatureTypeSpec
impl RefUnwindSafe for SignatureTypeSpec
impl Send for SignatureTypeSpec
impl Sync for SignatureTypeSpec
impl Unpin for SignatureTypeSpec
impl UnwindSafe for SignatureTypeSpec
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
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>
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>
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