MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / utilization_tracking

Function utilization_tracking

nodedb-bridge/src/buffer.rs:370–383  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

368
369 #[test]
370 fn utilization_tracking() {
371 let (mut tx, mut rx) = RingBuffer::channel::<u64>(8);
372
373 assert_eq!(tx.utilization(), 0);
374
375 for i in 0..6 {
376 tx.try_push(i).unwrap();
377 }
378 assert_eq!(tx.utilization(), 75);
379
380 rx.try_pop().unwrap();
381 rx.try_pop().unwrap();
382 assert_eq!(tx.utilization(), 50);
383 }
384
385 #[test]
386 fn drain_into_batch() {

Callers

nothing calls this directly

Calls 2

try_pushMethod · 0.80
try_popMethod · 0.80

Tested by

no test coverage detected