use core::future::Future;
use crate::error::CanError;
use crate::frame::{CanFdFrame, CanFrame, Frame, Timestamped};
pub trait AsyncTransmit {
type Error: CanError;
fn transmit(
&mut self,
frame: &CanFrame,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
pub trait AsyncReceive {
type Error: CanError;
type Timestamp: Clone + Send;
fn receive(
&mut self,
) -> impl Future<Output = Result<Timestamped<CanFrame, Self::Timestamp>, Self::Error>> + Send;
}
pub trait AsyncTransmitFd {
type Error: CanError;
fn transmit_fd(
&mut self,
frame: &CanFdFrame,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
pub trait AsyncReceiveFd {
type Error: CanError;
type Timestamp: Clone + Send;
fn receive_fd(
&mut self,
) -> impl Future<Output = Result<Timestamped<Frame, Self::Timestamp>, Self::Error>> + Send;
}