Skip to main content

weir_core/
lib.rs

1//! Core wire-protocol types shared by the weir daemon, client, and sink SDK.
2//!
3//! `weir-core` is the dependency-light foundation of the weir workspace: it
4//! defines the v1 binary frame format and nothing else (no I/O, no async, no
5//! daemon logic). Everything that crosses the socket is built from these types.
6//!
7//! # What's here
8//!
9//! - [`Envelope`] / [`Header`] — a complete wire frame and its 16-byte header,
10//!   with `encode`/`decode` that own the CRC and validation order.
11//! - [`MessageType`] / [`Durability`] / [`NackReason`] — the fixed-repr enums
12//!   carried in the header and Nack payloads, each with a `TryFrom<u8>` whose
13//!   error is [`UnknownMessageType`] / [`UnknownDurability`] / [`UnknownNackReason`]
14//!   (re-exported here alongside the enums).
15//! - [`Payload`] — opaque, ref-counted payload bytes (O(1) clone).
16//! - [`DecodeError`] / [`WeirError`] — the decode failure taxonomy.
17//! - [`WIRE_VERSION`] / [`MAX_PAYLOAD_HARD_CAP`] / [`HEADER_LEN`] /
18//!   [`MIN_FRAME_LEN`] — the protocol constants.
19//!
20//! The wire format itself is specified in `docs/wire_protocol.md`; this crate
21//! is its executable reference (see `tests/reference_frames.rs`).
22#![deny(missing_docs)]
23
24pub mod durability;
25pub mod envelope;
26pub mod error;
27pub mod nack;
28pub mod payload;
29pub mod version;
30
31pub use durability::{Durability, UnknownDurability};
32pub use envelope::{Envelope, HEADER_LEN, Header, MIN_FRAME_LEN, MessageType, UnknownMessageType};
33pub use error::{DecodeError, WeirError};
34pub use nack::{NackReason, UnknownNackReason};
35pub use payload::Payload;
36pub use version::{MAX_PAYLOAD_HARD_CAP, WIRE_VERSION};