moq_lite/lib.rs
1//! # moq-lite: Media over QUIC Transport
2//!
3//! `moq-lite` is designed for real-time live media delivery with sub-second latency at massive scale.
4//! This is a simplified subset of the *official* Media over QUIC (MoQ) transport, focusing on the practical features.
5//! ## API
6//! The API is built around Producer/Consumer pairs, with the hierarchy:
7//! - [Origin]: A collection of [Broadcast]s, produced by one or more [Session]s.
8//! - [Broadcast]: A collection of [Track]s, produced by a single publisher.
9//! - [Track]: A collection of [Group]s, delivered out-of-order until expired.
10//! - [Group]: A collection of [Frame]s, delivered in order until cancelled.
11//! - [Frame]: Chunks of data with an upfront size.
12//!
13//! ## Compatibility
14//! `moq-lite` purposely implements a subset of the IETF `moq-transport` specification.
15//! Many features are unsupported on purpose to keep the API and implementation clean,
16//! rather than pollute them with half-baked features.
17//!
18//! That said, the library is forwards-compatible with the full specification and
19//! supports moq-transport drafts 14+ via version negotiation. Everything will work
20//! perfectly, so long as your application uses the API as defined above.
21//!
22//! For example, there's no concept of "sub-group" in `moq-lite`. When connecting to
23//! a moq-transport implementation, we use `sub-group=0` for all frames and silently
24//! drop any received frames not in `sub-group=0`. If your application genuinely needs
25//! multiple sub-groups, tell me *why* and we can figure something out.
26//!
27//! ## Producers and Consumers
28//! Each level of the hierarchy is split into a Producer / Consumer pair:
29//! - The **Producer** is the writer: it appends new state (publishes a broadcast,
30//! starts a group, writes frames, closes a track).
31//! - The **Consumer** is a reader: each consumer holds its own independent view
32//! of the producer's state, with its own cursor through the stream.
33//!
34//! Both halves are cheaply clonable so you can hand out multiple handles. Cloning
35//! a consumer creates another reader (each at its own cursor); cloning a producer
36//! gives another writer that contributes to the same shared state. Closing the
37//! last producer signals consumers that no more updates are coming.
38//!
39//! ## Async
40//! This library is async-first, using [tokio] for async I/O and task management.
41//! Any plain `async` method should be awaited from inside an active tokio runtime.
42//! Otherwise you risk a panic.
43//!
44//! This requirement is being phased out as more methods grow `poll_xxx` counterparts
45//! built on [`conducer`], so you can drive them from custom executors without a tokio
46//! runtime. You can also call them synchronously, since [`conducer`] is built on the
47//! standard [`std::task::Waker`] API and any [`std::task::Waker`] is a valid driver.
48
49mod client;
50mod coding;
51mod error;
52mod ietf;
53mod lite;
54mod model;
55mod path;
56mod server;
57mod session;
58mod setup;
59mod version;
60
61pub use client::*;
62pub use coding::{BoundsExceeded, DecodeError, EncodeError};
63pub use error::*;
64pub use model::*;
65pub use path::*;
66pub use server::*;
67pub use session::*;
68pub use version::*;
69
70// Re-export the bytes crate
71pub use bytes;