pub struct MapTypeExtra {Show 18 fields
pub layout: MapLayout,
pub key: u64,
pub elem: u64,
pub group: u64,
pub hmap: Option<u64>,
pub hasher: Option<u64>,
pub group_size: Option<u64>,
pub slot_size: Option<u64>,
pub keys_off: Option<u64>,
pub key_stride: Option<u64>,
pub elems_off: Option<u64>,
pub elem_stride: Option<u64>,
pub elem_off: Option<u64>,
pub key_size: Option<u8>,
pub value_size: Option<u8>,
pub bucket_size: Option<u16>,
pub raw_flags: Option<u32>,
pub flags: MapFlags,
}Expand description
Parsed extra fields for a map type descriptor.
Fields absent from the descriptor’s MapLayout are None so callers can
tell “this Go version does not record it” from a genuine zero.
Fields§
§layout: MapLayoutWhich layout the descriptor was parsed with.
key: u64Virtual address of the key type descriptor.
elem: u64Virtual address of the element type descriptor.
group: u64Virtual address of the bucket (hmap) or slot-group (Swiss) type descriptor.
hmap: Option<u64>Virtual address of the hmap type descriptor
(MapLayout::HmapWithHmapType only — Go 1.11 removed the field).
hasher: Option<u64>Virtual address of the key-hashing function. None for Go 1.11-1.13,
which had no hasher field.
group_size: Option<u64>Size of a slot group in bytes (GroupSize). Swiss layouts only.
slot_size: Option<u64>Size of one key/elem slot (SlotSize). MapLayout::Swiss only —
Go 1.27 replaced it with the explicit stride fields below.
keys_off: Option<u64>Offset of the keys array within a group (KeysOff).
MapLayout::SwissSplitGroup only.
key_stride: Option<u64>Stride between consecutive keys (KeyStride).
MapLayout::SwissSplitGroup only.
elems_off: Option<u64>Offset of the elements array within a group (ElemsOff).
MapLayout::SwissSplitGroup only.
elem_stride: Option<u64>Stride between consecutive elements (ElemStride).
MapLayout::SwissSplitGroup only.
elem_off: Option<u64>Offset from a key to its element within a slot (ElemOff). Present in
both Swiss layouts.
key_size: Option<u8>Size of a key slot in bytes (KeySize). hmap layouts only.
value_size: Option<u8>Size of a value slot in bytes (ValueSize / elemsize). hmap layouts
only.
bucket_size: Option<u16>Size of a bucket in bytes (BucketSize). hmap layouts only.
raw_flags: Option<u32>Raw flags word. None for the pre-1.12 layouts, which encoded the
same properties as separate booleans. Bit meanings differ between the
hmap and Swiss eras — prefer Self::flags, which normalizes them.
flags: MapFlagsSemantic flags, normalized across all three encodings.
Implementations§
Source§impl MapTypeExtra
impl MapTypeExtra
Sourcepub fn size(ps: u8, layout: MapLayout) -> usize
pub fn size(ps: u8, layout: MapLayout) -> usize
Binary size of the extra for the given pointer size and layout.
Every layout is pointer_fields * ptrSize followed by an 8-byte tail —
either four small integers plus four booleans, or u8 + u8 + u16 + u32,
or (Swiss) a u32 padded out to pointer alignment. That comes to
pointers * ps + 8 on 64-bit and pointers * ps + 8 on 32-bit for the
hmap layouts, and pointers * ps + 4 (+4) for the Swiss ones.
Sourcepub fn parse(data: &[u8], ps: u8, layout: MapLayout) -> Option<Self>
pub fn parse(data: &[u8], ps: u8, layout: MapLayout) -> Option<Self>
Parse from data, which must start at the map type’s extra fields
(i.e. just past the embedded abi.Type).
A MapLayout::Probe layout is resolved against these bytes first, so
the returned Self::layout is always a concrete variant.
Returns None if the buffer is too small for the resolved layout.
Sourcepub fn key_stride(&self) -> Option<u64>
pub fn key_stride(&self) -> Option<u64>
Byte stride between consecutive keys in a bucket / group, however the descriptor’s layout happens to record it.
SwissSplitGroup states it directly as KeyStride; Swiss uses the
key/elem SlotSize as the stride for both; the hmap layouts pack keys
of KeySize contiguously in the bucket. None when the descriptor did
not carry the value.
Sourcepub fn elem_stride(&self) -> Option<u64>
pub fn elem_stride(&self) -> Option<u64>
Byte stride between consecutive elements, however the descriptor’s
layout records it. See Self::key_stride.
Trait Implementations§
Source§impl Clone for MapTypeExtra
impl Clone for MapTypeExtra
Source§fn clone(&self) -> MapTypeExtra
fn clone(&self) -> MapTypeExtra
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more