pub struct EventGroupEntry<T: AsRef<[u8]>> { /* private fields */ }Expand description
Zero-copy wrapper around an EventGroup Entry (16 bytes)
EventGroup entries are used for Subscribe/SubscribeAck messages. They share the same 16-byte structure as Service entries but use different fields for EventGroup ID and counter.
Wire format (16 bytes):
0 1 2 3
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Index 1st | Index 2nd | # of options |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Service ID | Instance ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Major Ver. | TTL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Reserved (12) |Cnt| EventGroup ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Implementations§
Source§impl<T: AsRef<[u8]>> EventGroupEntry<T>
impl<T: AsRef<[u8]>> EventGroupEntry<T>
Sourcepub fn new_unchecked(buffer: T) -> Self
pub fn new_unchecked(buffer: T) -> Self
Sourcepub fn new_checked(buffer: T) -> Result<Self>
pub fn new_checked(buffer: T) -> Result<Self>
Sourcepub fn check_len(&self) -> Result<()>
pub fn check_len(&self) -> Result<()>
Validate that the buffer is at least 16 bytes long.
§Returns
Ok(())if buffer meets minimum length requirementErr(Error)if buffer is too short
Sourcepub fn check_entry_type(&self) -> Result<()>
pub fn check_entry_type(&self) -> Result<()>
Validate the entry has a valid eventgroup entry type.
§Returns
Ok(())if entry type is Subscribe (0x06) or SubscribeAck (0x07)Err(Error::InvalidEntryType)if entry type is invalid for eventgroup entries
Sourcepub fn entry_type(&self) -> u8
pub fn entry_type(&self) -> u8
Get the entry type field (1 byte at offset 0).
§Returns
Entry type value (0x06=Subscribe, 0x07=SubscribeAck)
Sourcepub fn index_first_option_run(&self) -> u8
pub fn index_first_option_run(&self) -> u8
Get the index of the first option run (1 byte at offset 1).
§Returns
Index into the options array for the first run, or 0 if no options
Sourcepub fn index_second_option_run(&self) -> u8
pub fn index_second_option_run(&self) -> u8
Get the index of the second option run (1 byte at offset 2).
§Returns
Index into the options array for the second run, or 0 if no second run
Sourcepub fn number_of_options(&self) -> NumberOfOptions
pub fn number_of_options(&self) -> NumberOfOptions
Get the packed number of options (1 byte at offset 3).
§Returns
NumberOfOptions containing 4-bit counts for two option runs
Sourcepub fn service_id(&self) -> u16
pub fn service_id(&self) -> u16
Get the Service ID (2 bytes at offset 4-5, network byte order).
§Returns
16-bit Service ID identifying the service
Sourcepub fn instance_id(&self) -> u16
pub fn instance_id(&self) -> u16
Get the Instance ID (2 bytes at offset 6-7, network byte order).
§Returns
16-bit Instance ID identifying the service instance
Sourcepub fn major_version(&self) -> u8
pub fn major_version(&self) -> u8
Sourcepub fn ttl(&self) -> u32
pub fn ttl(&self) -> u32
Get the TTL (Time To Live) field (3 bytes at offset 9-11).
§Returns
24-bit TTL in seconds, or 0xFFFFFF for infinite lifetime
Sourcepub fn reserved_and_counter(&self) -> ReservedAndCounter
pub fn reserved_and_counter(&self) -> ReservedAndCounter
Get the packed reserved and counter field (2 bytes at offset 12-13).
§Returns
ReservedAndCounter containing 12-bit reserved field and 4-bit counter
Sourcepub fn eventgroup_id(&self) -> u16
pub fn eventgroup_id(&self) -> u16
Get the EventGroup ID (2 bytes at offset 14-15, network byte order).
§Returns
16-bit EventGroup ID identifying the event group
Source§impl<T: AsRef<[u8]> + AsMut<[u8]>> EventGroupEntry<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> EventGroupEntry<T>
Sourcepub fn set_entry_type(&mut self, value: u8)
pub fn set_entry_type(&mut self, value: u8)
Set the entry type field (1 byte at offset 0).
§Parameters
value- Entry type value (0x06=Subscribe, 0x07=SubscribeAck)
Sourcepub fn set_index_first_option_run(&mut self, value: u8)
pub fn set_index_first_option_run(&mut self, value: u8)
Set the index of the first option run (1 byte at offset 1).
§Parameters
value- Index into the options array for the first run
Sourcepub fn set_index_second_option_run(&mut self, value: u8)
pub fn set_index_second_option_run(&mut self, value: u8)
Set the index of the second option run (1 byte at offset 2).
§Parameters
value- Index into the options array for the second run
Sourcepub fn set_number_of_options(&mut self, value: NumberOfOptions)
pub fn set_number_of_options(&mut self, value: NumberOfOptions)
Set the packed number of options (1 byte at offset 3).
§Parameters
value- NumberOfOptions containing 4-bit counts for two option runs
Sourcepub fn set_service_id(&mut self, value: u16)
pub fn set_service_id(&mut self, value: u16)
Set the Service ID (2 bytes at offset 4-5, network byte order).
§Parameters
value- 16-bit Service ID identifying the service
Sourcepub fn set_instance_id(&mut self, value: u16)
pub fn set_instance_id(&mut self, value: u16)
Set the Instance ID (2 bytes at offset 6-7, network byte order).
§Parameters
value- 16-bit Instance ID identifying the service instance
Sourcepub fn set_major_version(&mut self, value: u8)
pub fn set_major_version(&mut self, value: u8)
Set the Major Version (1 byte at offset 8).
§Parameters
value- 8-bit major version of the service interface
Sourcepub fn set_ttl(&mut self, value: u32)
pub fn set_ttl(&mut self, value: u32)
Set the TTL (Time To Live) field (3 bytes at offset 9-11).
§Parameters
value- 24-bit TTL in seconds (lower 24 bits used), or 0xFFFFFF for infinite
Sourcepub fn set_reserved_and_counter(&mut self, value: ReservedAndCounter)
pub fn set_reserved_and_counter(&mut self, value: ReservedAndCounter)
Set the packed reserved and counter field (2 bytes at offset 12-13).
§Parameters
value- ReservedAndCounter containing 12-bit reserved field and 4-bit counter
Sourcepub fn set_eventgroup_id(&mut self, value: u16)
pub fn set_eventgroup_id(&mut self, value: u16)
Set the EventGroup ID (2 bytes at offset 14-15, network byte order).
§Parameters
value- 16-bit EventGroup ID identifying the event group
Trait Implementations§
Source§impl<T: Clone + AsRef<[u8]>> Clone for EventGroupEntry<T>
impl<T: Clone + AsRef<[u8]>> Clone for EventGroupEntry<T>
Source§fn clone(&self) -> EventGroupEntry<T>
fn clone(&self) -> EventGroupEntry<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more