Skip to main content

dustnet_client/
lib.rs

1#![forbid(unsafe_code)]
2// Remote content reaches every parser, layout and rendering path in this
3// crate, so an operation that can
4// panic on out-of-range input is a denial of service even though
5// `forbid(unsafe_code)` bounds it to an abort. Denied in non-test builds only:
6// tests assert on known-good values, where `unwrap` is the clearer spelling. A
7// new panicking operation on a production path fails `make ci` until it is
8// rewritten as a checked one, or exempted here with a reason.
9#![cfg_attr(
10    not(test),
11    deny(
12        clippy::indexing_slicing,
13        clippy::unwrap_used,
14        clippy::expect_used,
15        clippy::panic
16    )
17)]
18
19//! Production terminal client and rendering runtime.
20
21use dustnet_core::{color, parser, protocol, scanner, session};
22
23mod client;
24pub mod compositor;
25pub mod config;
26pub mod resource;
27pub mod session_file;
28mod session_store;
29mod transport;
30pub mod trust;
31pub mod viewer;
32
33pub use client::{TlsMode, TlsPolicy};
34pub use resource::{BudgetError, BudgetLease, ResourceCategory, ResourceGovernor};
35pub use viewer::{
36    ControlToken, OperationOwner, PageScope, SubscriptionRegionKey, ViewerEffect, ViewerEvent,
37    ViewerModel,
38};
39
40#[cfg(test)]
41pub(crate) fn repository_root() -> std::path::PathBuf {
42    std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
43        .ancestors()
44        .nth(2)
45        .expect("client crate is nested under workspace/crates")
46        .to_path_buf()
47}