1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#![doc = include_str!("../README.md")]
#![cfg_attr(not(feature = "std"), no_std)]
#![forbid(missing_docs)]
#![forbid(unsafe_code)]
#![warn(clippy::doc_markdown)]
#![cfg_attr(feature = "set_algebra", allow(incomplete_features))]
#![cfg_attr(feature = "set_algebra", feature(generic_const_exprs))]
use core::fmt::{Debug, Formatter, Result};
mod map;
pub use map::{PetitMap, SuccesfulMapInsertion};
mod set;
pub use set::{PetitSet, SuccesfulSetInsertion};
mod serde;
pub mod set_algebra;
#[derive(PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "thiserror_compat", derive(thiserror::Error))]
pub struct CapacityError<T>(pub T);
impl<T> Debug for CapacityError<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
f.debug_struct("A `PetitSet` or `PetitMap` has overflowed.")
.finish()
}
}
#[cfg(feature = "thiserror_compat")]
impl<T> std::fmt::Display for CapacityError<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
self::Debug::fmt(self, f)
}
}