matchmaker/
aliases.rs

1use std::ops::{Index, Range};
2
3use arrayvec::ArrayVec;
4
5/// Thread safe (items and fns)
6/// Sync and Send is required by Nucleo
7pub trait SSS: Send + Sync + 'static {}
8impl<T: Send + Sync + 'static> SSS for T {}
9
10// Send is required just for cycle_all_bg
11// todo: lowpri: get rid of this
12pub trait Selection: Send + 'static {}
13impl<T: Send + 'static> Selection for T {}
14pub type Identifier<T, S> = fn(&T) -> (u32, S);
15
16pub trait SegmentableItem: SSS + Index<Range<usize>, Output = str> {}
17impl<T: SSS + Index<Range<usize>, Output = str>> SegmentableItem for T {}
18
19// pub trait HashSetLike {}
20
21// pub trait HashMapLike {}
22
23pub const MAX_SPLITS: usize = 10;
24pub type RenderFn<T> = Box<dyn for<'a> Fn(&'a T, &'a str) -> String + Send + Sync>;
25pub type SplitterFn<T> = std::sync::Arc<dyn for<'a> Fn(&'a T) -> ArrayVec<(usize, usize), MAX_SPLITS> + Send + Sync>;
26
27pub const MAX_ACTIONS: usize = 6;
28pub const MAX_EFFECTS: usize = 12; // number of effect discriminants