feat(unicode,datastruct): port Unicode tables and data structures
ghostty-unicode: Ghostty computes codepoint properties with the uucode Zig package (v0.2.0, Unicode 17.0.0). There is no Rust equivalent, so a trimmed UCD set is vendored in ucd/ and build.rs re-implements uucode's derivations: cell width rules incl. Ghostty's overrides for emoji modifiers and Prepend, grapheme break classes with the compile-time grapheme_break state table, the is_symbol set, and emoji presentation. Lookups are three array indexes per codepoint. Validated against the official GraphemeBreakTest.txt. ghostty-datastruct: split_tree (used for GTK splits; f16 ratios so rounding and debug diagrams match Zig), circ_buf, lru, cache_table, blocking_queue, segmented_pool, message_data, comparison, array_list_collection. intrusive_linked_list is not needed (lru is index based). lru now reports the evicted (old) key, Zig reported the new key, which appears to be a bug. Not yet covered: case_folding_full (needed by input bindings). Test Plan: - cargo test -p ghostty-unicode (16) -p ghostty-datastruct (88) - cargo clippy for both crates with -D warnings
This commit is contained in:
1 parent
b96984b020
commit
5b8c92b98c
31 files changed
+18468
-3
No files matched your search
@@ -1 +1,40 @@
|
||||
//! ghostty-datastruct: see docs/rewrite/ARCHITECTURE.md for the module map.
|
||||
//! The datastruct package contains data structures or anything closely
|
||||
//! related to data structures. Port of `src/datastruct/*`.
|
||||
//!
|
||||
//! `intrusive_linked_list.zig` is intentionally not ported: its only user
|
||||
//! (`lru.zig`) is implemented with an index-based list here. See
|
||||
//! `docs/rewrite/notes/ghostty-datastruct.md`.
|
||||
|
||||
#![cfg_attr(
|
||||
test,
|
||||
allow(
|
||||
clippy::unwrap_used,
|
||||
clippy::float_cmp,
|
||||
clippy::assert_is_empty,
|
||||
clippy::redundant_closure_for_method_calls
|
||||
)
|
||||
)]
|
||||
|
||||
pub mod array_list_collection;
|
||||
pub mod blocking_queue;
|
||||
pub mod cache_table;
|
||||
pub mod circ_buf;
|
||||
pub mod comparison;
|
||||
pub mod lru;
|
||||
pub mod message_data;
|
||||
pub mod segmented_pool;
|
||||
pub mod split_tree;
|
||||
|
||||
pub use array_list_collection::ArrayListCollection;
|
||||
pub use blocking_queue::BlockingQueue;
|
||||
pub use cache_table::CacheTable;
|
||||
pub use circ_buf::CircBuf;
|
||||
pub use message_data::MessageData;
|
||||
pub use segmented_pool::SegmentedPool;
|
||||
pub use split_tree::SplitTree;
|
||||
|
||||
/// Stand-in for Zig's `Allocator.Error.OutOfMemory`, returned where a fixed
|
||||
/// capacity structure cannot accept more data.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
|
||||
#[error("out of memory")]
|
||||
pub struct OutOfMemory;
|
||||
Reference in new issue
Block a user