Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deny a couple of lints (missing_documentation and missing_debug_implementation) #18

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rust-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,21 @@ 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
}
}

/// 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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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<u8>`.
pub fn new(buf: &'a mut Vec<u8>) -> Self {
Self {
output: buf,
Expand Down
1 change: 1 addition & 0 deletions src/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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};
}
Loading