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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! Key types and traits for RART.
//!
//! This module provides the key types and traits that can be used with Adaptive Radix Trees.
//! Keys represent the lookup values and must implement the [`KeyTrait`] to work with the tree.
//!
//! ## Available Key Types
//!
//! - [`ArrayKey<N>`](array_key::ArrayKey): Fixed-size keys up to N bytes, stored on the stack
//! - [`VectorKey`](vector_key::VectorKey): Variable-size keys stored on the heap
//!
//! ## Custom Keys
//!
//! You can implement custom key types by implementing the [`KeyTrait`]:
//!
//! ```rust
//! use rart::keys::KeyTrait;
//! use rart::partials::Partial;
//!
//! // Example: A wrapper around a string that implements KeyTrait
//! // (You would need to implement all required methods)
//! ```
use cratePartial;
/// Trait for types that can be used as keys in an Adaptive Radix Tree.
///
/// This trait defines the interface that all key types must implement to work with RART.
/// Keys are the lookup values stored in the tree and must be convertible to byte sequences
/// for trie navigation.
///
/// ## Requirements
///
/// - Must be cloneable, comparable, and orderable
/// - Must provide access to underlying bytes via `AsRef<[u8]>`
/// - Must have an associated `PartialType` for prefix operations
/// - Must support conversion to/from partials for tree operations
///
/// ## Example Implementation
///
/// ```rust
/// use rart::keys::KeyTrait;
/// use rart::partials::{Partial, array_partial::ArrPartial};
///
/// // Note: This is a simplified example. Real implementations require
/// // implementing all trait methods properly.
/// ```