mirror of
https://github.com/rust-embedded/heapless.git
synced 2025-10-02 06:50:32 +00:00
histbuf: fix style
This commit is contained in:
parent
26dcfa3ae6
commit
9e08514d39
@ -122,7 +122,7 @@ where
|
|||||||
/// Writes an element to the buffer, overwriting the oldest value.
|
/// Writes an element to the buffer, overwriting the oldest value.
|
||||||
pub fn write(&mut self, t: T) {
|
pub fn write(&mut self, t: T) {
|
||||||
self.data[self.write_at] = t;
|
self.data[self.write_at] = t;
|
||||||
self.write_at = self.write_at + 1;
|
self.write_at += 1;
|
||||||
if self.write_at == self.len() {
|
if self.write_at == self.len() {
|
||||||
self.write_at = 0;
|
self.write_at = 0;
|
||||||
}
|
}
|
||||||
@ -156,9 +156,9 @@ where
|
|||||||
/// ```
|
/// ```
|
||||||
pub fn recent(&self) -> &T {
|
pub fn recent(&self) -> &T {
|
||||||
if self.write_at == 0 {
|
if self.write_at == 0 {
|
||||||
&self.data[(self.len() - 1)]
|
&self.data[self.len() - 1]
|
||||||
} else {
|
} else {
|
||||||
&self.data[(self.write_at - 1)]
|
&self.data[self.write_at - 1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user