Struct mavinspect::protocol::Dialect
source · pub struct Dialect { /* private fields */ }
Expand description
MAVLink dialect specification.
Implementations§
source§impl Dialect
impl Dialect
sourcepub fn new(
name: impl AsRef<str>,
version: Option<DialectVersion>,
dialect: Option<DialectId>,
messages: Vec<Message>,
enums: Vec<Enum>
) -> Self
pub fn new( name: impl AsRef<str>, version: Option<DialectVersion>, dialect: Option<DialectId>, messages: Vec<Message>, enums: Vec<Enum> ) -> Self
Default constructor
§Arguments
name
dialect name.version
dialect version (if provided).dialect
dialect ID.messages
dialect messages.enums
dialect enums.
sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Dialect name.
See Self::canonical_name
for canonical name used as a key in
Protocol::dialects
.
sourcepub fn canonical_name(&self) -> &str
pub fn canonical_name(&self) -> &str
Canonical dialect name.
As a dialect name we use a file base name of its XML definition (without extension). However,
upon XML parsing loading, we convert this name into canonical form
(using dialect_canonical_name
). Canonical names are used during dialect discovery by
Inspector
and in
InspectorBuilder::set_include
/InspectorBuilder::set_exclude
.
We do this in order to avoid naming collisions when someone tries to generate source code based on dialect names.
sourcepub fn version(&self) -> Option<DialectVersion>
pub fn version(&self) -> Option<DialectVersion>
Dialect version.
sourcepub fn messages(&self) -> impl IntoIterator<Item = &Message> + Clone
pub fn messages(&self) -> impl IntoIterator<Item = &Message> + Clone
Collection of dialect messages.
sourcepub fn enums(&self) -> impl IntoIterator<Item = &Enum> + Clone
pub fn enums(&self) -> impl IntoIterator<Item = &Enum> + Clone
Collection of dialect enums.
sourcepub fn commands(&self) -> impl IntoIterator<Item = &Command> + Clone
pub fn commands(&self) -> impl IntoIterator<Item = &Command> + Clone
Collection of dialect commands.
sourcepub fn contains_message_with_name(&self, name: &str) -> bool
pub fn contains_message_with_name(&self, name: &str) -> bool
Check that message with specified name
is present in dialect.
sourcepub fn contains_enum_with_name(&self, name: &str) -> bool
pub fn contains_enum_with_name(&self, name: &str) -> bool
Check that enum with specified name
is present in dialect.
sourcepub fn contains_command_with_name(&self, name: &str) -> bool
pub fn contains_command_with_name(&self, name: &str) -> bool
Check that command with specified name
is present in dialect.
sourcepub fn get_message_by_name(&self, name: &str) -> Option<&Message>
pub fn get_message_by_name(&self, name: &str) -> Option<&Message>
Get message with specified name
.
sourcepub fn get_enum_by_name(&self, name: &str) -> Option<&Enum>
pub fn get_enum_by_name(&self, name: &str) -> Option<&Enum>
Get enum with specified name
.
sourcepub fn get_command_by_name(&self, name: &str) -> Option<&Command>
pub fn get_command_by_name(&self, name: &str) -> Option<&Command>
Get command with specified name
.
sourcepub fn contains_message_with_id(&self, id: MessageId) -> bool
pub fn contains_message_with_id(&self, id: MessageId) -> bool
Check that message with specified id
is present in dialect.
sourcepub fn get_message_by_id(&self, id: MessageId) -> Option<&Message>
pub fn get_message_by_id(&self, id: MessageId) -> Option<&Message>
Get message with specified id
.
sourcepub fn microservices(&self) -> Microservices
pub fn microservices(&self) -> Microservices
MAVLink microservices supported by dialect.
sourcepub fn filtered(&self, filter: &Filter) -> Self
pub fn filtered(&self, filter: &Filter) -> Self
Creates a new instance of Dialect
with entities matching Filter
.
Use Dialect::retain
to filter an existing instance instead.
sourcepub fn retain(&mut self, filter: &Filter)
pub fn retain(&mut self, filter: &Filter)
Retain only entities matching provided Filter
.
This is an in-place version on Dialect::filtered
. The latter create a new filtered instance.
sourcepub fn fingerprint(&self) -> u64
pub fn fingerprint(&self) -> u64
Dialect fingerprint.
A 64-bit value that contains dialect CRC.