pub mod error;
#[cfg(feature = "tokio")]
pub mod tokio;
mod can_id;
pub use can_id::{CanBaseId, CanExtendedId, CanId, MAX_CAN_ID_BASE, MAX_CAN_ID_EXTENDED};
mod filter;
pub use filter::CanFilter;
mod frame;
pub use frame::CanFrame;
mod interface;
pub use interface::CanInterface;
mod socket;
pub use socket::CanSocket;
mod sys;
pub trait Deadline {
fn deadline(&self) -> std::time::Instant;
}
impl Deadline for std::time::Duration {
fn deadline(&self) -> std::time::Instant {
#[cfg(feature = "tokio")]
{
(::tokio::time::Instant::now() + *self).into_std()
}
#[cfg(not(feature = "tokio"))]
{
std::time::Instant::now() + *self
}
}
}
impl Deadline for std::time::Instant {
fn deadline(&self) -> std::time::Instant {
*self
}
}
#[cfg(feature = "tokio")]
impl Deadline for ::tokio::time::Instant {
fn deadline(&self) -> std::time::Instant {
self.into_std()
}
}