[][src]Struct rubble::phy::ChannelMap

pub struct ChannelMap { /* fields omitted */ }

A map marking data channels as used or unused.

A channel map must mark at least 2 channels as used.

Methods

impl ChannelMap[src]

pub fn from_raw(raw: [u8; 5]) -> Self[src]

Create a new channel map from the raw format used in Connection Request PDUs (ChM).

The first byte (LSB) contains flags for data channels 0 to 7, where the least significant bit is the flag for channel 0, and so on.

Since there are only 37 data channels, but 40 bits in the 5 Bytes, the 3 most significant bits in the last Byte of raw are considered reserved for future use (RFU) and are ignored by this function.

pub fn to_raw(&self) -> [u8; 5][src]

Returns the raw bytes encoding this channel map.

pub fn with_all_channels() -> Self[src]

Creates a new channel map that marks all data channels as used.

pub fn num_used_channels(&self) -> u8[src]

Returns the number of data channels marked as used by this map.

pub fn is_used(&self, channel: DataChannel) -> bool[src]

Returns whether the given data channel is marked as used.

pub fn iter_used<'a>(&'a self) -> impl Iterator<Item = DataChannel> + 'a[src]

Returns an iterator over all data channels marked as used in this map.

pub fn by_index(&self, n: u8) -> DataChannel[src]

Returns the nth channel marked as used.

Panics

This will panic when n >= self.num_used_channels().

Trait Implementations

impl PartialEq<ChannelMap> for ChannelMap[src]

impl Eq for ChannelMap[src]

impl Clone for ChannelMap[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for ChannelMap[src]

impl Debug for ChannelMap[src]

impl Display for ChannelMap[src]

Auto Trait Implementations

impl Send for ChannelMap

impl Sync for ChannelMap

Blanket Implementations

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> From for T[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]