Skip to content

Commit c4a5c87

Browse files
kixelatedclaude
andauthored
Add documentation to Rust public APIs (#834)
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 04790fa commit c4a5c87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+263
-217
lines changed

justfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ check:
292292
cargo clippy --all-targets --all-features -- -D warnings
293293
cargo fmt --all --check
294294

295+
# Check documentation warnings (only workspace crates, not dependencies)
296+
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --workspace
297+
295298
# requires: cargo install cargo-shear
296299
cargo shear
297300

rs/hang-cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ categories = ["multimedia", "network-programming", "web-programming"]
1414
[[bin]]
1515
name = "hang"
1616
path = "src/main.rs"
17+
doc = false
1718

1819
[features]
1920
default = ["iroh"]

rs/hang-cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub struct Cli {
2020
/// Iroh configuration
2121
#[command(flatten)]
2222
#[cfg(feature = "iroh")]
23-
iroh: moq_native::iroh::EndpointConfig,
23+
iroh: moq_native::IrohEndpointConfig,
2424

2525
#[command(subcommand)]
2626
command: Command,

rs/hang-cli/src/web.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use tower_http::services::ServeDir;
1212
// Initialize the HTTP server (but don't serve yet).
1313
pub async fn run_web(
1414
bind: SocketAddr,
15-
tls_info: Arc<RwLock<moq_native::TlsInfo>>,
15+
tls_info: Arc<RwLock<moq_native::ServerTlsInfo>>,
1616
public: Option<PathBuf>,
1717
) -> anyhow::Result<()> {
1818
let listen = tokio::net::lookup_host(bind)

rs/hang/src/catalog/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
//! The catalog describes available media tracks and codecs.
22
//!
3-
//! This module provides JSON-based catalog functionality that allows broadcasters
4-
//! to describe their available audio and video tracks, including codec information,
5-
//! resolution, bitrates, and other metadata. Consumers can subscribe to catalog
6-
//! tracks to discover and choose appropriate tracks for their capabilities.
3+
//! This is a JSON blob that can be live updated like any other track in MoQ.
4+
//! It describes the available audio and video tracks, including codec information,
5+
//! resolution, bitrates, and other metadata.
76
87
mod audio;
98
mod chat;
109
mod preview;
1110
mod root;
12-
mod track;
1311
mod user;
1412
mod video;
1513

1614
pub use audio::*;
1715
pub use chat::*;
1816
pub use preview::*;
1917
pub use root::*;
20-
pub use track::*;
2118
pub use user::*;
2219
pub use video::*;

rs/hang/src/catalog/root.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::sync::{Arc, Mutex, MutexGuard};
55
/// The catalog format is a JSON file that describes the tracks available in a broadcast.
66
use serde::{Deserialize, Serialize};
77

8-
use crate::catalog::{Audio, AudioConfig, Chat, Track, User, Video, VideoConfig};
8+
use crate::catalog::{Audio, AudioConfig, Chat, User, Video, VideoConfig};
99
use crate::Result;
1010
use moq_lite::Produce;
1111

@@ -39,7 +39,7 @@ pub struct Catalog {
3939

4040
/// Preview information about the broadcast
4141
#[serde(default)]
42-
pub preview: Option<Track>,
42+
pub preview: Option<moq_lite::Track>,
4343
}
4444

4545
impl Catalog {
@@ -138,7 +138,7 @@ impl Catalog {
138138
/// Produces a catalog track that describes the available media tracks.
139139
///
140140
/// The JSON catalog is updated when tracks are added/removed but is *not* automatically published.
141-
/// You'll have to call [`publish`](Self::publish) once all updates are complete.
141+
/// You'll have to call [`lock`](Self::lock) to update and publish the catalog.
142142
#[derive(Clone)]
143143
pub struct CatalogProducer {
144144
/// Access to the underlying track producer.
@@ -163,7 +163,7 @@ impl CatalogProducer {
163163
}
164164
}
165165

166-
/// Create a consumer for this catalog, receiving updates as they're [published](Self::publish).
166+
/// Create a consumer for this catalog, receiving updates as they're published.
167167
pub fn consume(&self) -> CatalogConsumer {
168168
CatalogConsumer::new(self.track.consume())
169169
}
@@ -180,6 +180,9 @@ impl From<moq_lite::TrackProducer> for CatalogProducer {
180180
}
181181
}
182182

183+
/// RAII guard for modifying a catalog with automatic publishing on drop.
184+
///
185+
/// Obtained via [`CatalogProducer::lock`].
183186
pub struct CatalogGuard<'a> {
184187
catalog: MutexGuard<'a, Catalog>,
185188
track: &'a mut moq_lite::TrackProducer,

rs/hang/src/catalog/track.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.

rs/hang/src/catalog/video/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub struct Display {
6969
#[serde(rename_all = "camelCase")]
7070
pub struct VideoConfig {
7171
/// The codec, see the registry for details:
72-
/// https://w3c.github.io/webcodecs/codec_registry.html
72+
/// <https://w3c.github.io/webcodecs/codec_registry.html>
7373
#[serde_as(as = "DisplayFromStr")]
7474
pub codec: VideoCodec,
7575

rs/hang/src/feedback/capabilities.rs

Lines changed: 0 additions & 44 deletions
This file was deleted.

rs/hang/src/feedback/mod.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)