pub struct ChannelMask(/* private fields */);Expand description
通道集合,bit i 对应序号为 i 的输入。
use seekdas::{Channel, ChannelMask};
let m = ChannelMask::from_iter([Channel::S0A, Channel::S2D]);
assert_eq!(m.bits(), 0x801);
assert_eq!(m.len(), 2);
assert!(m.contains(Channel::S2D));
assert_eq!(ChannelMask::slot(1).unwrap().bits(), 0x0F0);Implementations§
Source§impl ChannelMask
impl ChannelMask
Sourcepub const NONE: ChannelMask
pub const NONE: ChannelMask
空集合。
Sourcepub const ALL: ChannelMask
pub const ALL: ChannelMask
全部 12 路。
Sourcepub fn from_bits(bits: u16) -> ChannelMask
pub fn from_bits(bits: u16) -> ChannelMask
由位图构造(只取低 12 位)。
Sourcepub fn slot(slot: usize) -> Result<ChannelMask>
pub fn slot(slot: usize) -> Result<ChannelMask>
一个槽位的 4 路输入。
Sourcepub fn with(self, ch: Channel) -> ChannelMask
pub fn with(self, ch: Channel) -> ChannelMask
加入一路,返回新的集合。
Trait Implementations§
Source§impl Clone for ChannelMask
impl Clone for ChannelMask
Source§fn clone(&self) -> ChannelMask
fn clone(&self) -> ChannelMask
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ChannelMask
impl Debug for ChannelMask
Source§impl Default for ChannelMask
impl Default for ChannelMask
Source§fn default() -> ChannelMask
fn default() -> ChannelMask
Returns the “default value” for a type. Read more
Source§impl From<Channel> for ChannelMask
impl From<Channel> for ChannelMask
Source§impl FromIterator<Channel> for ChannelMask
impl FromIterator<Channel> for ChannelMask
Source§impl Hash for ChannelMask
impl Hash for ChannelMask
Source§impl PartialEq for ChannelMask
impl PartialEq for ChannelMask
impl Copy for ChannelMask
impl Eq for ChannelMask
impl StructuralPartialEq for ChannelMask
Auto Trait Implementations§
impl Freeze for ChannelMask
impl RefUnwindSafe for ChannelMask
impl Send for ChannelMask
impl Sync for ChannelMask
impl Unpin for ChannelMask
impl UnwindSafe for ChannelMask
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