#![cfg_attr(feature = "doc-cfg", feature(doc_cfg))]
#![warn(missing_docs)]
#![warn(missing_debug_implementations)]
pub mod error;
#[cfg(feature = "tokio")]
#[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "tokio")))]
pub mod tokio;
mod id;
pub use id::{ExtendedId, CanId, StandardId, MAX_EXTENDED_ID, MAX_STANDARD_ID};
mod filter;
pub use filter::CanFilter;
mod frame;
pub use frame::{CanFrame, CanData};
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()
}
}