pub trait Register:
Clone
+ Send
+ Sync
+ Any
+ 'static {
Show 23 methods
// Required methods
fn write_byte(&mut self, byte: u8);
fn read_byte(&self) -> Result<u8, RegisterTransferError>;
fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>;
fn baudrate(&self) -> u32;
fn data_bits(&self) -> DataBits;
fn stop_bits(&self) -> StopBits;
fn parity(&self) -> Parity;
fn clock_freq(&self) -> u32;
fn open(&mut self);
fn close(&mut self);
fn enable_loopback(&mut self);
fn disable_loopback(&mut self);
fn is_loopback_enabled(&self) -> bool;
fn set_irq_mask(&mut self, mask: InterruptMask);
fn get_irq_mask(&self) -> InterruptMask;
fn clean_interrupt_status(&mut self) -> InterruptMask;
fn line_status(&self) -> LineStatus;
fn read_reg(&self, offset: usize) -> u32;
fn write_reg(&mut self, offset: usize, value: u32);
fn get_base(&self) -> usize;
fn set_base(&mut self, base: NonNull<u8>);
// Provided methods
fn read_buf(
&mut self,
buf: &mut [u8],
) -> Result<usize, RegisterTransferError> { ... }
fn write_buf(&mut self, buf: &[u8]) -> usize { ... }
}Required Methods§
fn write_byte(&mut self, byte: u8)
fn read_byte(&self) -> Result<u8, RegisterTransferError>
fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>
fn baudrate(&self) -> u32
fn data_bits(&self) -> DataBits
fn stop_bits(&self) -> StopBits
fn parity(&self) -> Parity
fn clock_freq(&self) -> u32
fn open(&mut self)
fn close(&mut self)
Sourcefn enable_loopback(&mut self)
fn enable_loopback(&mut self)
启用回环模式
Sourcefn disable_loopback(&mut self)
fn disable_loopback(&mut self)
禁用回环模式
Sourcefn is_loopback_enabled(&self) -> bool
fn is_loopback_enabled(&self) -> bool
检查回环模式是否启用
Sourcefn set_irq_mask(&mut self, mask: InterruptMask)
fn set_irq_mask(&mut self, mask: InterruptMask)
设置中断使能掩码
Sourcefn get_irq_mask(&self) -> InterruptMask
fn get_irq_mask(&self) -> InterruptMask
获取当前中断使能掩码
Sourcefn clean_interrupt_status(&mut self) -> InterruptMask
fn clean_interrupt_status(&mut self) -> InterruptMask
获取并清除所有中断状态
Sourcefn line_status(&self) -> LineStatus
fn line_status(&self) -> LineStatus
获取线路状态
fn get_base(&self) -> usize
fn set_base(&mut self, base: NonNull<u8>)
Provided Methods§
fn read_buf(&mut self, buf: &mut [u8]) -> Result<usize, RegisterTransferError>
fn write_buf(&mut self, buf: &[u8]) -> usize
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.