1use std::ops::{Index, Range};
2
3use arrayvec::ArrayVec;
4
5pub trait SSS: Send + Sync + 'static {}
8impl<T: Send + Sync + 'static> SSS for T {}
9
10#[cfg(feature = "parallelism")]
11pub trait Selection: Send + 'static {}
12
13#[cfg(not(feature = "parallelism"))]
14pub trait Selection {}
15
16#[cfg(feature = "parallelism")]
17impl<T: Send + 'static> Selection for T {}
18
19#[cfg(not(feature = "parallelism"))]
20impl<T> Selection for T {}
21
22pub type Identifier<T, S> = fn(&T) -> (u32, S);
23
24pub trait SegmentableItem: SSS + Index<Range<usize>, Output = str> {}
25impl<T: SSS + Index<Range<usize>, Output = str>> SegmentableItem for T {}
26
27pub const MAX_SPLITS: usize = 10;
28pub type RenderFn<T> = Box<dyn for<'a> Fn(&'a T, &'a str) -> String + Send + Sync>;
29pub type SplitterFn<T> =
30 std::sync::Arc<dyn for<'a> Fn(&'a T) -> ArrayVec<(usize, usize), MAX_SPLITS> + Send + Sync>;
31
32pub const MAX_ACTIONS: usize = 6;