deepmesa_collections/lib.rs
1#![allow(warnings)]
2pub mod bitvec;
3pub(crate) mod fl;
4pub mod lhmap;
5pub mod linkedlist;
6
7/// Error type returned when a memory allocation operation fails.
8///
9/// This error contains both an error code indicating the type of failure
10/// and a descriptive message explaining what went wrong.
11///
12/// # Examples
13///
14/// ```
15/// # use deepmesa_collections::{TryAllocError, ErrorCode};
16/// // TryAllocError is typically created internally by the library
17/// // when allocation operations fail
18/// ```
19pub struct TryAllocError {
20 /// The error code indicating the type of failure
21 code: ErrorCode,
22 /// A descriptive message explaining the error
23 msg: String,
24}
25
26impl TryAllocError {
27 pub(crate) fn new(code: ErrorCode, msg: String) -> TryAllocError {
28 return TryAllocError { code, msg };
29 }
30}
31
32/// Error codes for memory allocation and capacity management operations.
33///
34/// These error codes are used to indicate various failure conditions
35/// when attempting to allocate or manage memory for collections.
36///
37/// # Examples
38///
39/// ```
40/// # use deepmesa_collections::ErrorCode;
41/// let error = ErrorCode::AllocError;
42/// // Handle allocation error appropriately
43/// ```
44pub enum ErrorCode {
45 /// Memory allocation failed
46 AllocError,
47 /// Memory layout computation failed
48 MemLayoutError,
49 /// Capacity overflow (requested capacity too large)
50 CapacityOverflow,
51}
52
53/// Error type returned when a memory reservation operation fails.
54///
55/// This error contains both an error code indicating the type of failure
56/// and a descriptive message explaining what went wrong.
57///
58/// # Examples
59///
60/// ```
61/// # use deepmesa_collections::TryReserveError;
62/// // TryReserveError is typically used by collections that support reservation
63/// ```
64pub struct TryReserveError {
65 /// The error code indicating the type of failure
66 pub code: ErrorCode,
67 /// A descriptive message explaining the error
68 pub msg: String,
69}
70
71impl TryReserveError {
72 pub(crate) fn new(code: ErrorCode, msg: String) -> TryReserveError {
73 return TryReserveError { code, msg };
74 }
75}
76
77pub use crate::lhmap::lhmap::LinkedHashMap;
78pub use crate::linkedlist::list::LinkedList;
79
80// /// This module contains structs specific to the [`LinkedHashMap`]
81// pub mod map {
82// pub use crate::lhmap::entry::Entry;
83// pub use crate::lhmap::entry::Order;
84// }
85
86pub use crate::bitvec::bitvec::BitVector;