libghostty_vt/lib.rs
1//! Idiomatic, safe Rust bindings for libghostty-vt, a terminal emulation library.
2//!
3//! # Memory management and lifetimes
4//!
5//! When creating the terminal and various other objects, you can control their
6//! memory management via a **custom allocator**, usually specified with
7//! methods like [`Terminal::new_with_alloc`]. Objects that accept allocators
8//! are also bound by the `'alloc` lifetime, since they internally contain
9//! a reference to the allocator. If you do not use a custom allocator,
10//! feel free to always set the lifetime to `'static`.
11//!
12//! ## Using the unstable `Allocator` API
13//!
14//! You can adapt the existing, unstable `Allocator` API into a
15//! [libghostty-friendly allocator](alloc::Allocator) via its `From`
16//! implementation. Note that the `'alloc` lifetime must at least
17//! live as long as the `Allocator` instance itself.
18//!
19//! # Thread safety
20//!
21//! All `libghostty-vt` objects are **not** thread-safe, and have been marked
22//! `!Send + !Sync` accordingly. The expectation is for them to be managed
23//! by a single thread, that may communicate with other threads via channels.
24#![warn(clippy::pedantic)]
25#![warn(missing_docs)]
26#![warn(missing_debug_implementations)]
27#![warn(missing_copy_implementations)]
28#![warn(clippy::allow_attributes)]
29#![warn(clippy::allow_attributes_without_reason)]
30#![allow(
31 clippy::missing_errors_doc,
32 reason = "underlying C API may return any error outside of expected and
33 mitigated situations, and it is not feasible to document them all"
34)]
35pub use libghostty_vt_sys as ffi;
36
37pub mod alloc;
38pub mod build_info;
39pub mod error;
40pub mod fmt;
41pub mod focus;
42pub mod key;
43pub mod mouse;
44pub mod osc;
45pub mod paste;
46pub mod render;
47pub mod screen;
48pub mod sgr;
49pub mod style;
50pub mod terminal;
51
52#[doc(inline)]
53pub use crate::{
54 error::Error,
55 render::RenderState,
56 terminal::{Options as TerminalOptions, Terminal},
57};