pub struct SpecificationFile {
pub datecode: i32,
pub texts: Vec<String>,
pub localized_texts: Vec<LocalizedText>,
pub units: Vec<Unit>,
pub device_templates: Vec<DeviceTemplate>,
pub packet_templates: Vec<PacketTemplate>,
}
Expand description
Contains the information from a VSF1 file.
Fields§
§datecode: i32
Date of VSF creation in format ‘YYYMMDD’
texts: Vec<String>
List of texts.
localized_texts: Vec<LocalizedText>
List of localized texts.
units: Vec<Unit>
List of units.
device_templates: Vec<DeviceTemplate>
List of device templates.
packet_templates: Vec<PacketTemplate>
List of packet templates.
Implementations§
Source§impl SpecificationFile
impl SpecificationFile
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<SpecificationFile, Error>
pub fn from_bytes(bytes: &[u8]) -> Result<SpecificationFile, Error>
Construct a new SpecificationFile
from a byte slice of VSF1 data.
Sourcepub fn new_default() -> SpecificationFile
pub fn new_default() -> SpecificationFile
Construct a new SpecificationFile
from the embedded default VSF data.
Sourcepub fn text_by_index(&self, idx: &TextIndex) -> &str
pub fn text_by_index(&self, idx: &TextIndex) -> &str
Get text by its index.
Sourcepub fn localized_text_by_index(
&self,
idx: &LocalizedTextIndex,
language: Language,
) -> &str
pub fn localized_text_by_index( &self, idx: &LocalizedTextIndex, language: Language, ) -> &str
Get localized text by its index and language.
Sourcepub fn unit_family_by_id(&self, id: &UnitFamilyId) -> UnitFamily
pub fn unit_family_by_id(&self, id: &UnitFamilyId) -> UnitFamily
Get UnitFamily
by its ID.
Sourcepub fn unit_by_id(&self, id: &UnitId) -> &Unit
pub fn unit_by_id(&self, id: &UnitId) -> &Unit
Get Unit
by its index.
Sourcepub fn type_by_id(&self, id: &TypeId) -> Type
pub fn type_by_id(&self, id: &TypeId) -> Type
Get Type
by its ID.
Sourcepub fn find_device_template(
&self,
self_address: u16,
peer_address: u16,
) -> Option<&DeviceTemplate>
pub fn find_device_template( &self, self_address: u16, peer_address: u16, ) -> Option<&DeviceTemplate>
Find a DeviceTemplate
matching the self and peer addresses.
Sourcepub fn find_packet_template(
&self,
destination_address: u16,
source_address: u16,
command: u16,
) -> Option<&PacketTemplate>
pub fn find_packet_template( &self, destination_address: u16, source_address: u16, command: u16, ) -> Option<&PacketTemplate>
Find a PacketTemplate
matching the destination and source addresses as well as the command.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SpecificationFile
impl RefUnwindSafe for SpecificationFile
impl Send for SpecificationFile
impl Sync for SpecificationFile
impl Unpin for SpecificationFile
impl UnwindSafe for SpecificationFile
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