Function rubble::link::queue::run_tests [−][src]
pub fn run_tests(queue: impl PacketQueue)
Expand description
Runs Rubble’s packet queue testsuite against the given PacketQueue
.
This can be used when implementing your own packet queue. Simply create a #[test]
function as
usual and call run_tests
from there. The function will panic when any test fails.
The passed queue
must be an empty queue with bounded space for at least one packet. “Bounded”
here means that the queue must have a finite, practical size as the test suite may fill it up
completely.
Simultaneously, this function ensures that PacketQueue
implementors can be used by a generic
function, something that sometimes doesn’t work when invariant lifetimes are involved.