Skip to content

Commit 7c2b810

Browse files
committed
can: try_ prefixes and improved documentation
1 parent 285efaa commit 7c2b810

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/can.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,21 @@ pub trait Can {
6868
/// Associated error type.
6969
type Error;
7070

71-
/// Puts a frame in the transmit buffer.
71+
/// Puts a frame in the transmit buffer to be sent on the bus.
7272
///
73-
/// If the buffer is full, this function will try to replace a lower priority frame
74-
/// and return it. This is to avoid the priority inversion problem.
75-
/// Transmits frames of equal identifier in FIFO fashion.
76-
fn transmit(&mut self, frame: &Self::Frame) -> nb::Result<Option<Self::Frame>, Self::Error>;
73+
/// If the transmit buffer is full, this function will try to replace a pending
74+
/// lower priority frame and return the frame that was replaced.
75+
/// Returns `Err(WouldBlock)` if the transmit buffer is full and no frame can be
76+
/// replaced.
77+
///
78+
/// # Notes for implementers
79+
///
80+
/// * Frames of equal identifier shall be transmited in FIFO fashion when more
81+
/// than one transmit buffer is available.
82+
/// * When replacing pending frames make sure the frame is not in the process of
83+
/// being send to the bus.
84+
fn try_transmit(&mut self, frame: &Self::Frame) -> nb::Result<Option<Self::Frame>, Self::Error>;
7785

7886
/// Returns a received frame if available.
79-
fn receive(&mut self) -> nb::Result<Self::Frame, Self::Error>;
87+
fn try_receive(&mut self) -> nb::Result<Self::Frame, Self::Error>;
8088
}

0 commit comments

Comments
 (0)