Skip to main content

pushwire_core/
lib.rs

1//! `push-wire-core` — shared types and codecs for the push-wire protocol.
2//!
3//! This crate contains the wire types, binary codec, fragment assembler,
4//! and delta algorithm shared by both `push-wire-server` and `push-wire-client`.
5//! All public types are parameterized by the [`ChannelKind`] trait, allowing
6//! consumers to define their own channel taxonomy.
7
8pub mod binary;
9pub mod channel;
10pub mod delta;
11pub mod fragments;
12pub mod types;
13
14#[cfg(feature = "rtc")]
15pub mod rtc;
16
17// Core trait
18pub use channel::{ChannelKind, parse_channels};
19
20// Frame types (generic over C: ChannelKind)
21pub use types::{BinaryEnvelope, Frame, RawPayload, SystemOp};
22
23// Binary codec (generic over C: ChannelKind)
24pub use binary::{
25    BinaryError, BinaryFlags, BinaryFrame, CompressionConfig, CompressionDictionary, MAGIC_HEADER,
26    PayloadEncoding, VERSION_BYTE, decode_frame, decode_frame_with_dictionaries, encode_frame,
27    encode_frame_with_compression, train_dictionary,
28};
29
30// Delta
31pub use delta::{DeltaApplyResult, DeltaError, DeltaOp, PayloadDelta, apply_delta, compute_delta};
32
33// Fragments
34pub use fragments::{
35    FRAGMENT_HEADER_LEN, FragmentAssembler, FragmentError, FragmentRetention, FragmentShard,
36};
37
38// WebRTC signaling (optional)
39#[cfg(feature = "rtc")]
40pub use rtc::{RtcMessage, RtcRouter, TurnCredential};