pub struct ExpGolombCodec;
Expand description
Exp‑Golomb Codec: requires a runtime parameter (e.g. k).
This codec supports the Exp‑Golomb coding scheme which is parameterized by k
. For more information refer to the ExpGolomb
module.
Note: When k=1, the Exp‑Golomb code is equivalent to the Gamma code.
Implementations§
Source§impl ExpGolombCodec
impl ExpGolombCodec
Sourcepub fn encode<E: Endianness, W: ExpGolombWrite<E>>(
writer: &mut W,
value: u64,
k: usize,
) -> Result<usize, Box<dyn Error>>
pub fn encode<E: Endianness, W: ExpGolombWrite<E>>( writer: &mut W, value: u64, k: usize, ) -> Result<usize, Box<dyn Error>>
Encodes a value using Exp‑Golomb coding with the specified parameter k
.
Sourcepub fn decode<E: Endianness, R>(
reader: &mut R,
k: usize,
) -> Result<u64, Box<dyn Error>>where
R: ExpGolombRead<E>,
pub fn decode<E: Endianness, R>(
reader: &mut R,
k: usize,
) -> Result<u64, Box<dyn Error>>where
R: ExpGolombRead<E>,
Decodes a value using Exp‑Golomb coding with the specified parameter k
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExpGolombCodec
impl RefUnwindSafe for ExpGolombCodec
impl Send for ExpGolombCodec
impl Sync for ExpGolombCodec
impl Unpin for ExpGolombCodec
impl UnwindSafe for ExpGolombCodec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
Source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
Source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
Truncate the current UnsignedInt to a possibly smaller size
Source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
Source§impl<T> UpcastableFrom<T> for T
impl<T> UpcastableFrom<T> for T
Source§fn upcast_from(value: T) -> T
fn upcast_from(value: T) -> T
Extend the current UnsignedInt to a possibly bigger size.