| 1 |
// This file is part of ICU4X. For terms of use, please see the file |
| 2 |
// called LICENSE at the top level of the ICU4X source tree |
| 3 |
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). |
| 4 |
|
| 5 |
/// Intermediate metadata for a branch node under construction. |
| 6 |
#[derive(Debug, Clone, Copy)] |
| 7 |
pub(crate) struct BranchMeta { |
| 8 |
/// The lead byte for this branch. Formerly it was required to be an ASCII byte, but now |
| 9 |
/// it can be any byte. |
| 10 |
pub ascii: u8, |
| 11 |
/// The size in bytes of the trie data reachable from this branch. |
| 12 |
pub local_length: usize, |
| 13 |
/// The size in bytes of this and all later sibling branches. |
| 14 |
pub cumulative_length: usize, |
| 15 |
/// The number of later sibling branches, including this. |
| 16 |
pub count: usize, |
| 17 |
} |
| 18 |
|
| 19 |
impl BranchMeta { |
| 20 |
/// Creates a new empty [`BranchMeta`]. |
| 21 |
pub const fn default() -> Self { |
| 22 |
BranchMeta { |
| 23 |
ascii: 0, |
| 24 |
cumulative_length: 0, |
| 25 |
local_length: 0, |
| 26 |
count: 0, |
| 27 |
} |
| 28 |
} |
| 29 |
} |