umsh_text/
lib.rs

1#![allow(async_fn_in_trait)]
2#![cfg_attr(not(feature = "std"), no_std)]
3
4//! Text-message support for UMSH.
5//!
6//! This crate implements the stateful text-message protocol once, for use by
7//! both mobile applications and embedded pagers:
8//!
9//! - [`codec`]: exact wire bytes — borrowed decoding and encoding, with
10//!   extension options preserved for profile-specific validation. Works
11//!   without `alloc`.
12//! - [`validate`]: semantic validation of a decoded message in conversation
13//!   context, selected by a [`validate::TextProfile`].
14//! - [`engine`]: a deterministic sans-I/O reducer owning sequence
15//!   allocation, deduplication, fragmentation, reassembly, and bounded
16//!   repair. It receives commands and emits effects and events; platform
17//!   code owns presentation, storage, and transports.
18//! - Node-layer convenience wrappers (feature `node`) for chat-style
19//!   applications built directly on `umsh-node`.
20
21#[cfg(feature = "alloc")]
22extern crate alloc;
23
24#[cfg(all(feature = "std", not(feature = "alloc")))]
25compile_error!("feature `std` requires feature `alloc`");
26
27pub mod codec;
28mod error;
29pub mod model;
30pub mod validate;
31
32pub mod engine;
33
34#[cfg(feature = "alloc")]
35mod owned;
36
37#[cfg(feature = "node")]
38mod node_adapter;
39
40pub use error::{EncodeError, ParseError, TextSendError};
41pub use model::{
42    ConversationKey, ExtensionOptions, FRAGMENT_BODY_MAX, FRAGMENT_COUNT_MAX, Fragment,
43    MessageSequence, MessageType, REASSEMBLED_BODY_MAX, Regarding, SenderScope, TextMessage,
44    WireRef,
45};
46
47pub use codec::{ParseInfo, encode as encode_text_message, parse as parse_text_message};
48
49#[cfg(feature = "alloc")]
50pub use owned::{OwnedExtensionOptions, OwnedTextMessage};
51
52#[cfg(feature = "node")]
53pub use node_adapter::{TextReceiveIssue, UnicastTextChatWrapper, parse_text_payload};
54
55#[cfg(all(feature = "node", feature = "software-crypto"))]
56pub use node_adapter::MulticastTextChatWrapper;
57
58/// Namespace for raw text-message codec functions.
59pub mod text_message {
60    pub use crate::codec::{encode, parse, parse_with_info};
61}