slice_rbtree/lib.rs
1#![doc = include_str!("../README.md")]
2#![deny(unsafe_op_in_unsafe_fn)]
3#![deny(missing_debug_implementations)]
4#![deny(missing_docs)]
5#![cfg_attr(not(any(test, internal_checks, fuzzing)), no_std)]
6
7use borsh::{BorshDeserialize, BorshSerialize};
8
9pub mod forest;
10pub mod tree;
11
12/// Possible errors for [`RBTree`](tree::RBTree) and [`RBForest`](forest::RBForest)
13#[derive(Debug, PartialEq, Eq, Copy, Clone, BorshDeserialize, BorshSerialize)]
14pub enum Error {
15 /// Failed to serialize key to key buffer, maybe it is too big?
16 KeySerializationError,
17 /// no free nodes left in the slice
18 NoNodesLeft,
19 /// the provided slice is too big for the map: the map internally uses `u32` indices, so there
20 /// can't be more than `u32::MAX` nodes
21 TooBig,
22 /// the provided slice is too small for the map
23 TooSmall,
24 /// failed to serialize value to value buffer, maybe it is too big?
25 ValueSerializationError,
26 /// key size of the map does not match key size of the type
27 WrongKeySize,
28 /// struct header has incorrect magic, maybe it is not initialized?
29 WrongMagic,
30 /// node pool size from the map header does not match the actual slice size
31 WrongNodePoolSize,
32 /// slice size is incorrect
33 WrongSliceSize,
34 /// value size of the map does not match key size of the type
35 WrongValueSize,
36 /// There are fewer trees than the supplied tree_id
37 TooBigTreeId,
38}