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::{
29        AnyStreamReader, ByteStreamReader, StreamCloser, StreamReader, TextStreamReader,
30    };
31    pub use crate::info::{ByteStreamInfo, TextStreamInfo};
32    pub use crate::outgoing::{
33        ByteStreamWriter, SendByteOptions, SendTextOptions, StreamByteOptions,
34        StreamProgressCallback, StreamTextOptions, StreamWriter, TextStreamWriter,
35    };
36    pub use crate::types::OperationType;
37    pub use crate::utils::{SendError, StreamError, StreamProgress, StreamResult};
38}
39
40/// Internal APIs used within the `livekit` SDK to power data streams.
41pub mod backend {
42    // Wire types + their proto conversions, used by the room to build packets and events.
43    pub use crate::types::{
44        ByteHeader, Chunk, CompressionType, ContentHeader, Header, OperationType, Packet, StreamId,
45        TextHeader, Trailer,
46    };
47
48    /// Incoming data streams.
49    pub mod incoming {
50        pub use crate::incoming::{events::*, manager::*};
51    }
52
53    /// Outgoing data streams.
54    pub mod outgoing {
55        pub use crate::outgoing::manager::*;
56    }
57
58    #[cfg(any(test, feature = "test-utils"))]
59    pub use crate::test_utils::*;
60}