Skip to main content

livekit_data_stream/
lib.rs

1// Copyright 2026 LiveKit, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#![doc = include_str!("../README.md")]
16
17mod incoming;
18mod info;
19mod outgoing;
20#[cfg(any(test, feature = "test-utils"))]
21mod test_utils;
22mod types;
23mod utf8_chunk;
24mod utils;
25
26/// Public API re-exported by client SDKs (surfaced to end users through the `livekit` crate).
27pub mod api {
28    pub use crate::incoming::{AnyStreamReader, ByteStreamReader, StreamReader, TextStreamReader};
29    pub use crate::info::{ByteStreamInfo, TextStreamInfo};
30    pub use crate::outgoing::{
31        ByteStreamWriter, StreamByteOptions, StreamTextOptions, StreamWriter, TextStreamWriter,
32    };
33    pub use crate::types::OperationType;
34    pub use crate::utils::{SendError, StreamError, StreamProgress, StreamResult};
35}
36
37/// Internal APIs used within the `livekit` SDK to power data streams.
38pub mod backend {
39    // Wire types + their proto conversions, used by the room to build packets and events.
40    pub use crate::types::{
41        ByteHeader, Chunk, CompressionType, ContentHeader, Header, OperationType, Packet, StreamId,
42        TextHeader, Trailer,
43    };
44
45    /// Incoming data streams.
46    pub mod incoming {
47        pub use crate::incoming::{events::*, manager::*};
48    }
49
50    /// Outgoing data streams.
51    pub mod outgoing {
52        pub use crate::outgoing::manager::*;
53    }
54
55    #[cfg(any(test, feature = "test-utils"))]
56    pub use crate::test_utils::*;
57}