permoot/
error.rs

1/// An invalid array or function representation was encountered
2#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
3pub enum InvalidArrFnRepr {
4	/// The output (`value`) for the `input` is too large (should have been `<= max`)
5	#[allow(missing_docs)]
6	InvalidValue {
7		input: usize,
8		value: usize,
9		max: usize,
10	},
11	/// The output (`value`) is associated to at least two different inputs
12	#[allow(missing_docs)]
13	RepeatedValue {
14		first_input: usize,
15		second_input: usize,
16		value: usize,
17	},
18}
19
20#[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
21/// An location of any single value in [`Cycles`](crate::reprs::Cycles)
22pub struct CycleElementLocation {
23	/// The index of the cycle containing the value
24	pub cycle_index: usize,
25	/// The index of the value inside the cycle
26	pub index: usize,
27}
28
29/// An invalid cycle representation was encountered
30#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
31pub enum InvalidCycleRepr {
32	/// A too large `value` at `location` (should have been `<= max`)
33	#[allow(missing_docs)]
34	InvalidValue {
35		location: CycleElementLocation,
36		value: usize,
37		max: usize,
38	},
39	/// The `value` appears in multiple locations (either in multiple cycles or multiple times in a single cycle)
40	#[allow(missing_docs)]
41	RepeatedValue {
42		first_occurrence: CycleElementLocation,
43		second_occurrence: CycleElementLocation,
44		value: usize,
45	},
46}
47
48/// An invalid swap representation was encountered
49#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
50pub enum InvalidSwapRepr {
51	/// The left value of the swap at `index` is too large (should have been `<= max`)
52	#[allow(missing_docs)]
53	InvalidLeftValue {
54		index: usize,
55		value: usize,
56		max: usize,
57	},
58	/// The right value of the swap at `index` is too large (should have been `<= max`)
59	#[allow(missing_docs)]
60	InvalidRightValue {
61		index: usize,
62		value: usize,
63		max: usize,
64	},
65}
66
67/// Tried to use a slice longer than `self.max` in the context of a permutation on `self.max` objects
68#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
69#[allow(missing_docs)]
70pub struct TooLongSliceForPermutation {
71	pub length: usize,
72	pub max: usize,
73}