pub struct Dialect { /* private fields */ }
Expand description

MAVLink dialect specification.

Implementations§

source§

impl Dialect

source

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.
source

pub fn name(&self) -> &str

Dialect name.

See Self::canonical_name for canonical name used as a key in Protocol::dialects.

source

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.

source

pub fn version(&self) -> Option<DialectVersion>

Dialect version.

source

pub fn dialect(&self) -> Option<DialectId>

Dialect ID.

source

pub fn messages(&self) -> impl IntoIterator<Item = &Message> + Clone

Collection of dialect messages.

source

pub fn enums(&self) -> impl IntoIterator<Item = &Enum> + Clone

Collection of dialect enums.

source

pub fn commands(&self) -> impl IntoIterator<Item = &Command> + Clone

Collection of dialect commands.

source

pub fn contains_message_with_name(&self, name: &str) -> bool

Check that message with specified name is present in dialect.

source

pub fn contains_enum_with_name(&self, name: &str) -> bool

Check that enum with specified name is present in dialect.

source

pub fn contains_command_with_name(&self, name: &str) -> bool

Check that command with specified name is present in dialect.

source

pub fn get_message_by_name(&self, name: &str) -> Option<&Message>

Get message with specified name.

source

pub fn get_enum_by_name(&self, name: &str) -> Option<&Enum>

Get enum with specified name.

source

pub fn get_command_by_name(&self, name: &str) -> Option<&Command>

Get command with specified name.

source

pub fn contains_message_with_id(&self, id: MessageId) -> bool

Check that message with specified id is present in dialect.

source

pub fn get_message_by_id(&self, id: MessageId) -> Option<&Message>

Get message with specified id.

source

pub fn microservices(&self) -> Microservices

MAVLink microservices supported by dialect.

source

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.

source

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.

source

pub fn fingerprint(&self) -> u64

Dialect fingerprint.

A 64-bit value that contains dialect CRC.

Trait Implementations§

source§

impl Clone for Dialect

source§

fn clone(&self) -> Dialect

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Dialect

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Dialect

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for Dialect

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,