| 1 | use craterust-analyzer cargo ringbuf 0.3.3 crate/::HeapRbrust-analyzer cargo ringbuf 0.3.3 alias/HeapRb#; |
| 2 | |
| 3 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 4 | fn producerrust-analyzer cargo ringbuf 0.3.3 tests/cached/producer().() { |
| 5 | let (mut prod, mut cons) = HeapRbrust-analyzer cargo ringbuf 0.3.3 alias/HeapRb#::<i32>::newrust-analyzer cargo ringbuf 0.3.3 ring_buffer/init/impl#[`SharedRb<T, Vec<MaybeUninit<T>>>`]new().(2).splitrust-analyzer cargo ringbuf 0.3.3 ring_buffer/shared/impl#[`SharedRb<T, C>`]split().(); |
| 6 | prod.pushrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 7 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(cons.iterrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(0..1)); |
| 8 | |
| 9 | { |
| 10 | let mut post_prod = prod.postponedrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]postponed().(); |
| 11 | |
| 12 | post_prod.pushrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 13 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(cons.iterrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(0..1)); |
| 14 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(cons.lenrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]len().(), 1); |
| 15 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(post_prod.lenrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]len().(), 2); |
| 16 | |
| 17 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(cons.poprust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]pop().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 0); |
| 18 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(cons.poprust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]pop().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().()); |
| 19 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(cons.lenrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]len().(), 0); |
| 20 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(post_prod.lenrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]len().(), 2); |
| 21 | |
| 22 | post_prod.syncrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, RbWrap<RbWriteCache<T, R>>>`]sync().(); |
| 23 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(cons.iterrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(1..2)); |
| 24 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(cons.lenrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]len().(), 1); |
| 25 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(post_prod.lenrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]len().(), 1); |
| 26 | |
| 27 | post_prod.pushrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push().(2).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 28 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(cons.iterrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(1..2)); |
| 29 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(cons.lenrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]len().(), 1); |
| 30 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(post_prod.lenrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]len().(), 2); |
| 31 | } |
| 32 | |
| 33 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(cons.iterrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(1..3)); |
| 34 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(cons.lenrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]len().(), 2); |
| 35 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(prod.lenrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]len().(), 2); |
| 36 | } |
| 37 | |
| 38 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 39 | fn discardrust-analyzer cargo ringbuf 0.3.3 tests/cached/discard().() { |
| 40 | let (mut prod, cons) = HeapRbrust-analyzer cargo ringbuf 0.3.3 alias/HeapRb#::<i32>::newrust-analyzer cargo ringbuf 0.3.3 ring_buffer/init/impl#[`SharedRb<T, Vec<MaybeUninit<T>>>`]new().(10).splitrust-analyzer cargo ringbuf 0.3.3 ring_buffer/shared/impl#[`SharedRb<T, C>`]split().(); |
| 41 | prod.pushrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 42 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(cons.iterrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(0..1)); |
| 43 | |
| 44 | { |
| 45 | let mut post_prod = prod.postponedrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]postponed().(); |
| 46 | |
| 47 | post_prod.pushrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 48 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(cons.lenrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]len().(), 1); |
| 49 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(post_prod.lenrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]len().(), 2); |
| 50 | |
| 51 | post_prod.syncrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, RbWrap<RbWriteCache<T, R>>>`]sync().(); |
| 52 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(cons.iterrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(0..2)); |
| 53 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(cons.lenrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]len().(), 2); |
| 54 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(post_prod.lenrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]len().(), 2); |
| 55 | |
| 56 | post_prod.pushrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push().(3).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 57 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(cons.lenrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]len().(), 2); |
| 58 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(post_prod.lenrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]len().(), 3); |
| 59 | |
| 60 | post_prod.discardrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, RbWrap<RbWriteCache<T, R>>>`]discard().(); |
| 61 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(cons.lenrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]len().(), 2); |
| 62 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(post_prod.lenrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]len().(), 2); |
| 63 | |
| 64 | post_prod.pushrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push().(2).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 65 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(cons.lenrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]len().(), 2); |
| 66 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(post_prod.lenrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]len().(), 3); |
| 67 | } |
| 68 | |
| 69 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(cons.iterrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(0..3)); |
| 70 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(cons.lenrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]len().(), 3); |
| 71 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(prod.lenrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]len().(), 3); |
| 72 | } |
| 73 | |
| 74 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 75 | fn consumerrust-analyzer cargo ringbuf 0.3.3 tests/cached/consumer().() { |
| 76 | let (mut prod, mut cons) = HeapRbrust-analyzer cargo ringbuf 0.3.3 alias/HeapRb#::<i32>::newrust-analyzer cargo ringbuf 0.3.3 ring_buffer/init/impl#[`SharedRb<T, Vec<MaybeUninit<T>>>`]new().(10).splitrust-analyzer cargo ringbuf 0.3.3 ring_buffer/shared/impl#[`SharedRb<T, C>`]split().(); |
| 77 | prod.pushrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 78 | prod.pushrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 79 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(cons.iterrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(0..2)); |
| 80 | |
| 81 | { |
| 82 | let mut post_cons = cons.postponedrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]postponed().(); |
| 83 | |
| 84 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(post_cons.poprust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]pop().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 0); |
| 85 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(post_cons.iterrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(1..2)); |
| 86 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(post_cons.lenrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]len().(), 1); |
| 87 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(prod.lenrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]len().(), 2); |
| 88 | |
| 89 | prod.pushrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]push().(2).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 90 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(post_cons.iterrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(1..2)); |
| 91 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(post_cons.lenrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]len().(), 1); |
| 92 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(prod.lenrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]len().(), 3); |
| 93 | |
| 94 | post_cons.syncrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, RbWrap<RbReadCache<T, R>>>`]sync().(); |
| 95 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(post_cons.iterrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(1..3)); |
| 96 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(post_cons.lenrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]len().(), 2); |
| 97 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(prod.lenrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]len().(), 2); |
| 98 | |
| 99 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(post_cons.poprust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]pop().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1); |
| 100 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(post_cons.iterrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(2..3)); |
| 101 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(post_cons.lenrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]len().(), 1); |
| 102 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(prod.lenrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]len().(), 2); |
| 103 | } |
| 104 | |
| 105 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(cons.iterrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(2..3)); |
| 106 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(cons.lenrust-analyzer cargo ringbuf 0.3.3 consumer/impl#[`Consumer<T, R>`]len().(), 1); |
| 107 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(prod.lenrust-analyzer cargo ringbuf 0.3.3 producer/impl#[`Producer<T, R>`]len().(), 1); |
| 108 | } |