Skip to content

Commit

Permalink
Merge 6e7f99a into dbb3849
Browse files Browse the repository at this point in the history
  • Loading branch information
wcampbell0x2a committed Feb 10, 2024
2 parents dbb3849 + 6e7f99a commit 53caf58
Showing 1 changed file with 0 additions and 26 deletions.
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(always)]
Expand Down

0 comments on commit 53caf58

Please sign in to comment.