Skip to main content

Crate libghostty_vt

Crate libghostty_vt 

Source
Expand description

Idiomatic, safe Rust bindings for libghostty-vt, a terminal emulation library.

§Memory management and lifetimes

When creating the terminal and various other objects, you can control their memory management via a custom allocator, usually specified with methods like Terminal::new_with_alloc. Objects that accept allocators are also bound by the 'alloc lifetime, since they internally contain a reference to the allocator. If you do not use a custom allocator, feel free to always set the lifetime to 'static.

§Using the unstable Allocator API

You can adapt the existing, unstable Allocator API into a libghostty-friendly allocator via its From implementation. Note that the 'alloc lifetime must at least live as long as the Allocator instance itself.

§Thread safety

All libghostty-vt objects are not thread-safe, and have been marked !Send + !Sync accordingly. The expectation is for them to be managed by a single thread, that may communicate with other threads via channels.

Re-exports§

pub use libghostty_vt_sys as ffi;

Modules§

alloc
Adapting custom allocators to work with libghostty.
build_info
Query compile-time build configuration of libghostty-vt.
error
Error handling.
fmt
Format terminal content as plain text, VT sequences, or HTML.
focus
Encoding focus gained/lost events into terminal escape sequences (CSI I / CSI O) for focus reporting mode (mode 1004).
key
Encoding key events into terminal escape sequences,
mouse
Encoding mouse events into terminal escape sequences.
osc
Handling OSC (Operating System Command) escape sequences.
paste
Utilities for validating paste data safety.
render
Managing render states of the terminal.
screen
Terminal screen cell and row types.
sgr
Handling SGR (Select Graphic Rendition) escape sequences.
style
Terminal cell style attributes.
terminal
Types and functions around terminal state management.

Structs§

RenderState
Represents the state required to render a visible screen (a viewport) of a terminal instance.
Terminal
Complete terminal emulator state and rendering.
TerminalOptions
Terminal initialization options.

Enums§

Error
Possible errors libghostty-vt may return.