pub trait OneWireAsync {
type Status: OneWireStatus;
type BusError;
// Required methods
async fn reset(&mut self) -> OneWireResult<Self::Status, Self::BusError>;
async fn write_byte(
&mut self,
byte: u8,
) -> OneWireResult<(), Self::BusError>;
async fn read_byte(&mut self) -> OneWireResult<u8, Self::BusError>;
async fn write_bit(
&mut self,
bit: bool,
) -> OneWireResult<(), Self::BusError>;
async fn read_bit(&mut self) -> OneWireResult<bool, Self::BusError>;
async fn get_overdrive_mode(
&mut self,
) -> OneWireResult<bool, Self::BusError>;
// Provided method
async fn set_overdrive_mode(
&mut self,
_enable: bool,
) -> OneWireResult<(), Self::BusError> { ... }
}Expand description
Trait for 1-Wire communication. This trait defines the basic operations required for 1-Wire communication, such as resetting the bus, writing and reading bytes, and writing and reading bits.
Required Associated Types§
Sourcetype Status: OneWireStatus
type Status: OneWireStatus
The status type returned by the reset operation. This type must implement the OneWireStatus trait.
Required Methods§
Sourceasync fn reset(&mut self) -> OneWireResult<Self::Status, Self::BusError>
async fn reset(&mut self) -> OneWireResult<Self::Status, Self::BusError>
Sourceasync fn write_byte(&mut self, byte: u8) -> OneWireResult<(), Self::BusError>
async fn write_byte(&mut self, byte: u8) -> OneWireResult<(), Self::BusError>
Sourceasync fn read_byte(&mut self) -> OneWireResult<u8, Self::BusError>
async fn read_byte(&mut self) -> OneWireResult<u8, Self::BusError>
Sourceasync fn read_bit(&mut self) -> OneWireResult<bool, Self::BusError>
async fn read_bit(&mut self) -> OneWireResult<bool, Self::BusError>
Sourceasync fn get_overdrive_mode(&mut self) -> OneWireResult<bool, Self::BusError>
async fn get_overdrive_mode(&mut self) -> OneWireResult<bool, Self::BusError>
Check if the 1-Wire bus is in overdrive mode.
§Returns
A result containing a boolean indicating whether the bus is in overdrive mode.
Provided Methods§
Sourceasync fn set_overdrive_mode(
&mut self,
_enable: bool,
) -> OneWireResult<(), Self::BusError>
async fn set_overdrive_mode( &mut self, _enable: bool, ) -> OneWireResult<(), Self::BusError>
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.