pub struct EnterpriseFieldRegistry { /* private fields */ }Expand description
Registry for storing user-defined enterprise field definitions
This registry is used internally by parsers to look up custom field metadata during parsing.
Implementations§
Source§impl EnterpriseFieldRegistry
impl EnterpriseFieldRegistry
Sourcepub fn with_max_capacity(max: usize) -> Self
pub fn with_max_capacity(max: usize) -> Self
Create a new empty registry with a maximum capacity.
Once the limit is reached, further register calls
that would insert new entries are silently ignored. Replacements of
existing (enterprise_number, field_number) pairs are always allowed.
§Panics
Panics if max is 0. A zero-capacity registry would silently drop
every registration attempt.
Sourcepub fn register(&mut self, def: EnterpriseFieldDef) -> bool
pub fn register(&mut self, def: EnterpriseFieldDef) -> bool
Register a single enterprise field definition
If a field with the same enterprise number and field number already exists,
it will be replaced. If a max_capacity is set and the registry is full,
new (non-replacement) entries are dropped and false is returned.
Sourcepub fn register_many(
&mut self,
defs: impl IntoIterator<Item = EnterpriseFieldDef>,
) -> usize
pub fn register_many( &mut self, defs: impl IntoIterator<Item = EnterpriseFieldDef>, ) -> usize
Register multiple enterprise field definitions at once. Returns the number of definitions successfully registered.
Sourcepub fn get(
&self,
enterprise_number: u32,
field_number: u16,
) -> Option<&EnterpriseFieldDef>
pub fn get( &self, enterprise_number: u32, field_number: u16, ) -> Option<&EnterpriseFieldDef>
Look up a field definition by enterprise number and field number
Trait Implementations§
Source§impl Clone for EnterpriseFieldRegistry
impl Clone for EnterpriseFieldRegistry
Source§fn clone(&self) -> EnterpriseFieldRegistry
fn clone(&self) -> EnterpriseFieldRegistry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more