Files
unshell/src/lib.rs
T

45 lines
1.4 KiB
Rust
Raw Normal View History

2026-04-24 12:32:24 -06:00
//! UnShell core protocol crate.
//!
//! The crate now models the draft protocol in `PROTOCOL.md` directly:
//!
//! - [`protocol`] provides the canonical wire types, framing helpers, validation,
//! and introspection payloads.
//! - [`tree`] provides an explicit enum-based tree declaration, longest-prefix
//! routing helpers, and a small endpoint runtime for tests.
//! - [`transport`] provides framed transport implementations for simulated
//! channel-based links and TCP links.
//! - [`logger`] remains available for lightweight logging.
//!
//! ```rust
//! use unshell::protocol::{CallMessage, HookTarget, PacketHeader, PacketType, encode_packet};
//!
//! let header = PacketHeader {
//! packet_type: PacketType::Call,
//! src_path: Vec::new(),
//! dst_path: vec!["child".into()],
//! dst_leaf: Some("echo".into()),
//! hook_id: None,
//! };
//! let call = CallMessage {
//! procedure_id: "org.product.v1.echo.roundtrip".into(),
//! data: b"ping".to_vec(),
//! response_hook: Some(HookTarget {
//! hook_id: 1,
//! return_path: Vec::new(),
//! }),
//! };
//!
//! let frame = encode_packet(&header, &call).expect("call should encode");
//! assert!(!frame.is_empty());
//! ```
2026-03-17 16:40:05 -06:00
2026-04-24 12:32:24 -06:00
#![cfg_attr(not(feature = "std"), no_std)]
2026-03-17 16:40:05 -06:00
extern crate alloc;
2025-11-09 12:34:52 -07:00
pub mod logger;
pub mod protocol;
pub mod transport;
pub mod tree;
pub use ush_obfuscate as obfuscate;