diff --git a/.github/workflows/rust-coverage.yml b/.github/workflows/rust-coverage.yml index 1b187f6..fd35298 100644 --- a/.github/workflows/rust-coverage.yml +++ b/.github/workflows/rust-coverage.yml @@ -37,7 +37,7 @@ jobs: token: ${{secrets.CODECOV_TOKEN}} - name: Archive code coverage results - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: code-coverage-report path: cobertura.xml 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/edit.rs b/src/edit.rs index e5ea493..fb18b54 100644 --- a/src/edit.rs +++ b/src/edit.rs @@ -3,6 +3,7 @@ use crate::{RtpPacket, RtpParseError, RtpWriteError}; /// Mutable parsed RTP packet for editing of some fields. +#[derive(Debug)] #[repr(transparent)] pub struct RtpPacketMut<'a> { data: &'a mut [u8], diff --git a/src/lib.rs b/src/lib.rs index ad10b95..719f87b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,14 @@ // 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; mod packet; @@ -11,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}; }