pub struct ExtensionDataTypeId(pub u32);Expand description
Stable u32 id for an extension variant.
Extension ids are generated deterministically from a stable name via
ExtensionDataTypeId::from_name. A crate that never changes its
extension name keeps the same id across versions, which is the
wire-format contract: a Program encoded by v1.0 of an extension
decodes identically in v1.1 so long as the name is stable.
Tuple Fields§
§0: u32Implementations§
Source§impl ExtensionDataTypeId
impl ExtensionDataTypeId
Sourcepub const EXTENSION_RANGE_MASK: u32 = 2147483648
pub const EXTENSION_RANGE_MASK: u32 = 2147483648
Reserved range: every extension id has its high bit set.
Core IR discriminants occupy 0x00..=0x7F; extensions occupy
0x80..=0xFFFF_FFFF. Wire decoders test the high byte to route
decoding between the two.
Sourcepub const fn from_name(name: &str) -> Self
pub const fn from_name(name: &str) -> Self
Construct an id from a stable extension name.
The id is derived deterministically with FNV-1a and folded into
the extension range by setting the high bit. Callers that pass
the same name always get the same id.
Sourcepub const fn is_extension(self) -> bool
pub const fn is_extension(self) -> bool
Is this a reserved extension id (high bit set)?
Trait Implementations§
Source§impl Clone for ExtensionDataTypeId
impl Clone for ExtensionDataTypeId
Source§fn clone(&self) -> ExtensionDataTypeId
fn clone(&self) -> ExtensionDataTypeId
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more