pub trait Address:
VariantArray
+ Clone
+ Send
+ Sync
+ Sized
+ 'static {
// Required methods
fn vector_field_or_scalar(&self) -> (Self, VectorField);
fn to_u16(&self) -> u16;
fn name(&self) -> &'static str;
fn type_(&self) -> Type;
// Provided methods
fn fields(&self) -> Option<[(Self, VectorField); 3]> { ... }
fn from_u16_typed(val: u16, ty: Type) -> Option<Self> { ... }
fn from_name(name: &str) -> Option<Self> { ... }
}Expand description
Trait for global or field addresses
Required Methods§
Sourcefn vector_field_or_scalar(&self) -> (Self, VectorField)
fn vector_field_or_scalar(&self) -> (Self, VectorField)
For addresses that are a component of a vector, this returns the address of the vector itself along with the field of the vector that it relates to (x, y, or z). For other fields, this is a no-op.
Provided Methods§
Sourcefn fields(&self) -> Option<[(Self, VectorField); 3]>
fn fields(&self) -> Option<[(Self, VectorField); 3]>
For vector globals, returns the component fields. For scalars, just returns self.
Sourcefn from_u16_typed(val: u16, ty: Type) -> Option<Self>
fn from_u16_typed(val: u16, ty: Type) -> Option<Self>
Convert a raw offset into the relevant FieldAddr, given the type. Certain
field offsets are specified to overlap in the progdefs.qc in order to have
quick access to fields of vectors, and this can distinguish between vector foo
and float foo_x.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.