pub struct CanonicalType {
pub name: String,
pub fields: Vec<CanonicalField>,
pub data_size: usize,
}Expand description
A canonical type representing the finalized layout of an evolved type
Fields§
§name: StringThe name of the type
fields: Vec<CanonicalField>All fields in layout order
data_size: usizeTotal data size in bytes (computed from fields)
Implementations§
Source§impl CanonicalType
impl CanonicalType
Sourcepub fn new(name: String, fields: Vec<CanonicalField>) -> Self
pub fn new(name: String, fields: Vec<CanonicalField>) -> Self
Create a new canonical type from fields
Sourcepub fn get_field(&self, name: &str) -> Option<&CanonicalField>
pub fn get_field(&self, name: &str) -> Option<&CanonicalField>
Get field by name
Sourcepub fn field_offset(&self, name: &str) -> Option<usize>
pub fn field_offset(&self, name: &str) -> Option<usize>
Get field offset by name
Sourcepub fn is_field_optional(&self, name: &str) -> bool
pub fn is_field_optional(&self, name: &str) -> bool
Check if field is optional
Trait Implementations§
Source§impl Clone for CanonicalType
impl Clone for CanonicalType
Source§fn clone(&self) -> CanonicalType
fn clone(&self) -> CanonicalType
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 moreSource§impl Debug for CanonicalType
impl Debug for CanonicalType
Source§impl PartialEq for CanonicalType
impl PartialEq for CanonicalType
impl StructuralPartialEq for CanonicalType
Auto Trait Implementations§
impl Freeze for CanonicalType
impl RefUnwindSafe for CanonicalType
impl Send for CanonicalType
impl Sync for CanonicalType
impl Unpin for CanonicalType
impl UnsafeUnpin for CanonicalType
impl UnwindSafe for CanonicalType
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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