radicle-protocol 0.8.0

The Radicle Protocol
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::num::NonZeroUsize;

use radicle::test::arbitrary;

use crate::fetcher::{Config, MaxQueueSize, RefsToFetch};

pub fn config(max_concurrency: usize, max_queue_size: usize) -> Config {
    Config::new()
        .with_max_concurrency(NonZeroUsize::new(max_concurrency).unwrap())
        .with_max_capacity(MaxQueueSize::new(
            NonZeroUsize::new(max_queue_size).unwrap(),
        ))
}

pub fn gen_refs(count: usize) -> RefsToFetch {
    let refs: Vec<_> = (0..count).map(|_| arbitrary::r#gen(1)).collect();
    refs.into()
}