From eb852cb6e01ca60d114af4df59babff216860fea Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Thu, 14 Nov 2024 16:12:25 +1100 Subject: [PATCH 1/3] ensure types expose a debug implementation --- src/edit.rs | 1 + src/lib.rs | 2 ++ 2 files changed, 3 insertions(+) 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..b55f95c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,7 @@ // SPDX-License-Identifier: MIT OR Apache-2.0 +#![deny(missing_debug_implementations)] + mod builder; mod edit; mod packet; From 699d482aef77fdd846f1b85d414d265adeba4fea Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Thu, 14 Nov 2024 16:24:12 +1100 Subject: [PATCH 2/3] 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}; } From 2fed9a8e9a2406f2b6b20232e5a4b9261e540c9a Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Thu, 14 Nov 2024 17:03:23 +1100 Subject: [PATCH 3/3] ci: update artifact action to v4 https://github.blog/changelog/2024-02-13-deprecation-notice-v1-and-v2-of-the-artifact-actions/ --- .github/workflows/rust-coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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