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

Remove unused DekuWrite trait #419

Merged
merged 1 commit into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 0 additions & 26 deletions src/impls/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,6 @@ trait DekuRead<'a, Ctx = ()> {
Self: Sized;
}

/// "Writer" trait: write from type to bits
trait DekuWrite<Ctx = ()> {
/// Write type to bits
/// * **output** - Sink to store resulting bits
/// * **ctx** - A context required by context-sensitive reading. A unit type `()` means no context
/// needed.
fn write(
&self,
output: &mut crate::bitvec::BitVec<u8, crate::bitvec::Msb0>,
ctx: Ctx,
) -> Result<(), DekuError>;
}

/// Implements DekuWrite for references of types that implement DekuWrite
impl<T, Ctx> DekuWrite<Ctx> for &T
where
T: DekuWrite<Ctx>,
Ctx: Copy,
{
/// Write value of type to bits
fn write(&self, output: &mut BitVec<u8, Msb0>, ctx: Ctx) -> Result<(), DekuError> {
<T>::write(self, output, ctx)?;
Ok(())
}
}

// specialize u8 for ByteSize
impl DekuRead<'_, (Endian, ByteSize)> for u8 {
#[inline]
Expand Down