Struct arinc_429::Message[][src]

pub struct Message(_);

An ARINC 429 message

The bits of a message are represented exactly as transmitted on the wires, with the least significant bit transmitted first.

The label field is in the 8 least significant bits. Because the most significant digit of the label is transmitted first, the label field is in the reverse of the usual bit order.

The parity bit is the most significant bit.

Conversions

The u32::from(Message) and Message::from(u32) From implementations copy bits with no changes.

Some ARINC 429 adapters use a different representation, where the bits of the label field are reversed from their on-wire representation. The methods Message::from_bits_label_swapped() and Message::bits_label_swapped() implement this conversion.

Conversions never panic.

Examples

Create a message

let message = Message::from(0x10000056);
assert_eq!(0x10000056, u32::from(message));

Label bit swapping

let message = Message::from_bits_label_swapped(0x10000056);
assert_eq!(0x1000006a, u32::from(message));

Methods

impl Message
[src]

Returns the bits that represent this message

Returns the bits of this message, but with the order of the 8 label bits reversed.

Creates a message from a message representation with the 8 label bits reversed. The returned Msg429 will be represented as transmitted on the wires.

Checks the parity of this message, and returns an error if the parity is not odd

Examples

assert!(Message::from(0x0).check_parity().is_err());
assert!(Message::from(0xf03ccccc).check_parity().is_err());
assert!(Message::from(0x1).check_parity().is_ok());
assert!(Message::from(0xf13ccccc).check_parity().is_ok());

Calculates the parity of this message and returns a new message with the parity bit (31) to the correct value

Examples

// Create a message with incorrect (even) parity
let message = Message::from(0x22443300);
assert_eq!(message.update_parity().bits(), 0xa2443300);
// Create a message with correct (odd) parity
let message = Message::from(0x22443301);
// Message should not change
assert_eq!(message.update_parity(), message);

Trait Implementations

impl Debug for Message
[src]

Formats the value using the given formatter. Read more

impl Copy for Message
[src]

impl Clone for Message
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Message
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Message
[src]

impl PartialOrd for Message
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for Message
[src]

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl Hash for Message
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl Default for Message
[src]

Returns the "default value" for a type. Read more

impl From<u32> for Message
[src]

Creates a message from bits as transmitted, with no modifications

impl From<Message> for u32
[src]

Converts a message into bits, with no modifications

Auto Trait Implementations

impl Send for Message

impl Sync for Message