From 699d482aef77fdd846f1b85d414d265adeba4fea Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Thu, 14 Nov 2024 16:24:12 +1100 Subject: [PATCH] deny missing documentation and implement missing docs --- src/builder.rs | 7 +++++++ src/lib.rs | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/src/builder.rs b/src/builder.rs index 094184e..6698980 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -318,7 +318,9 @@ impl<'a, 'b> RtpPacketBuilder<&'a [u8], &'b [u8]> { /// Trait to provide the length of a piece of data in bytes. pub trait PayloadLength { + /// The length of the data in bytes. fn len(&self) -> usize; + /// Whether the data contains any bytes. fn is_empty(&self) -> bool { self.len() != 0 } @@ -326,8 +328,11 @@ pub trait PayloadLength { /// Trait to write an RTP packet into and/or from custom data types. pub trait RtpPacketWriter { + /// The type of the output. type Output; + /// The type of the RTP payload to be stored in the output packet. type Payload: PayloadLength; + /// The type of the RTP extension data to be stored in the output packet:was. type Extension: PayloadLength; /// Reserve a number of bytes in the output. Multiple calls are possible and provide the @@ -445,6 +450,7 @@ pub struct RtpPacketWriterMutSlice<'a, 'b, 'c> { } impl<'a, 'b, 'c> RtpPacketWriterMutSlice<'a, 'b, 'c> { + /// Construct a new [`RtpPacketWriterMutSlice`] from the provided slice. pub fn new(buf: &'a mut [u8]) -> Self { Self { output: buf, @@ -520,6 +526,7 @@ pub struct RtpPacketWriterMutVec<'a, 'b, 'c> { } impl<'a, 'b, 'c> RtpPacketWriterMutVec<'a, 'b, 'c> { + /// Construct a new [`RtpPacketWriterMutVec`] from a provided mutable `Vec`. pub fn new(buf: &'a mut Vec) -> Self { Self { output: buf, diff --git a/src/lib.rs b/src/lib.rs index b55f95c..719f87b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,13 @@ // SPDX-License-Identifier: MIT OR Apache-2.0 #![deny(missing_debug_implementations)] +#![deny(missing_docs)] + +//! # rtp-types +//! +//! An implementation of parsing, writing, and editing RTP packets as specified in [RFC 3550] +//! +//! [RFC 3550]: https://tools.ietf.org/html/rfc3550 mod builder; mod edit; @@ -13,6 +20,7 @@ pub use builder::{ pub use edit::RtpPacketMut; pub use packet::{RtpPacket, RtpParseError}; +/// Prelude module for defined/implementable traits pub mod prelude { pub use crate::builder::{PayloadLength, RtpPacketWriter}; }