File: static.rs

package info (click to toggle)
rust-ringbuf 0.3.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 324 kB
  • sloc: makefile: 4
file content (15 lines) | stat: -rw-r--r-- 338 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#![no_std]

use ringbuf::StaticRb;

fn main() {
    const RB_SIZE: usize = 1;
    let mut rb = StaticRb::<i32, RB_SIZE>::default();
    let (mut prod, mut cons) = rb.split_ref();

    assert_eq!(prod.push(123), Ok(()));
    assert_eq!(prod.push(321), Err(321));

    assert_eq!(cons.pop(), Some(123));
    assert_eq!(cons.pop(), None);
}