types/
types.rs

1// Copyright 2024 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4pub use std::ops::Range;
5
6#[derive(Debug)]
7#[allow(dead_code)] // This is included in two targets. It is exercised in lib, but not in 'gen'.
8pub struct CCCEntry {
9    /// The exclusive, lower 16-bits of end of the range for a given entry.
10    /// e.g. If 0xfff0..0xffff maps to 222 (say), then this would contain 0xfffe but not 0xffff
11    pub low_plane_end_ix: u16,
12    /// The size of the range. e.g. For range 2..6, this would be 4.
13    pub range_len: u8,
14    /// The CCC for this range. Note that we don't store CCC=0.
15    pub ccc: u8,
16}
17impl CCCEntry {
18    #[allow(dead_code)]
19    pub fn range(&self) -> Range<u16> {
20        (self.low_plane_end_ix - self.range_len as u16)..self.low_plane_end_ix
21    }
22}
23
24#[derive(Debug)]
25#[allow(dead_code)] // This is included in two targets. It is exercised in lib, but not in 'gen'.
26pub struct MappingOffset {
27    /// The exclusive, lower 16-bits of a codepoint in a code plane.
28    pub low_plane_ix: u16,
29    /// A mapping offset (e.g. into a string table)
30    pub offset: u16,
31}