Skip to content

Commit 5d35622

Browse files
committed
split into separate tx/rx traits
1 parent 94b2c2d commit 5d35622

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

embedded-can/src/asynch.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
//! Async CAN API
22
3-
/// An async CAN interface that is able to transmit and receive frames.
4-
pub trait Can {
3+
/// An async CAN interface that is able to transmit frames.
4+
pub trait CanTx {
55
/// Associated frame type.
66
type Frame: crate::Frame;
77

88
/// Associated error type.
99
type Error: crate::Error;
1010

11-
/// Puts a frame in the transmit buffer.
12-
/// Awaits until space is available in the transmit buffer.
11+
/// Puts a frame in the transmit buffer or awaits until space is available
12+
/// in the transmit buffer.
1313
async fn transmit(&mut self, frame: &Self::Frame) -> Result<(), Self::Error>;
14+
}
15+
16+
/// An async CAN interface that is able to receive frames.
17+
pub trait CanRx {
18+
/// Associated frame type.
19+
type Frame: crate::Frame;
20+
21+
/// Associated error type.
22+
type Error: crate::Error;
1423

15-
/// Awaits until a frame was received or an error occurred.
24+
/// Awaits until a frame was received or an error occurs.
1625
async fn receive(&mut self) -> Result<Self::Frame, Self::Error>;
1726
}

0 commit comments

Comments
 (0)