Struct LocalConstant
pub struct LocalConstant {
pub rid: u32,
pub token: Token,
pub offset: usize,
pub name: String,
pub signature: SignatureField,
}Expand description
High-level representation of a LocalConstant table entry
This structure provides the resolved form of LocalConstant table data
with all heap indices resolved to their actual values. The name field
contains the resolved string data from the #Strings heap, and the
signature field contains the parsed type signature from the #Blob heap.
§Usage Examples
use dotscope::metadata::tables::LocalConstant;
use dotscope::metadata::signatures::TypeSignature;
// Access constant information with parsed signature
println!("Constant '{}' with type: {:?}", constant.name, constant.signature.base);
// Check the constant's type
match &constant.signature.base {
TypeSignature::I4 => println!("Integer constant"),
TypeSignature::String => println!("String constant"),
TypeSignature::R8 => println!("Double constant"),
_ => println!("Other type constant"),
}
// Check for custom modifiers
if !constant.signature.modifiers.is_empty() {
println!("Constant has {} custom modifiers", constant.signature.modifiers.len());
}Fields§
§rid: u32Row identifier (1-based index in the table)
token: TokenMetadata token for this LocalConstant entry
offset: usizeByte offset of this row in the original metadata stream
name: StringConstant name resolved from #Strings heap
The actual name string for this local constant. May be empty for anonymous or compiler-generated constants where no name was specified.
signature: SignatureFieldParsed constant signature describing the constant’s type
The structured representation of the constant’s type signature, parsed from the #Blob heap. This provides immediate access to the constant’s type information including the base type and any custom modifiers, without requiring additional parsing steps.
The signature describes:
- Base Type: The fundamental type of the constant (int, string, etc.)
- Custom Modifiers: Optional type annotations for advanced scenarios
- Type Constraints: Generic type parameters and their constraints
Parsing is performed automatically during the conversion from raw to owned representation, providing structured access to type information.
Trait Implementations§
§impl Clone for LocalConstant
impl Clone for LocalConstant
§fn clone(&self) -> LocalConstant
fn clone(&self) -> LocalConstant
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for LocalConstant
impl RefUnwindSafe for LocalConstant
impl Send for LocalConstant
impl Sync for LocalConstant
impl Unpin for LocalConstant
impl UnwindSafe for LocalConstant
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