chore: impl todo for filler decode
This commit is contained in:
parent
0a476d0592
commit
9d8afee3d2
|
@ -1,5 +1,11 @@
|
||||||
use crate::decoder::Decoder;
|
use crate::{decoder::Decoder, filler::Filler};
|
||||||
|
|
||||||
pub trait Decode<'b>: Sized {
|
pub trait Decode<'b>: Sized {
|
||||||
fn decode(d: &mut Decoder<'b>) -> Result<Self, String>;
|
fn decode(d: &mut Decoder<'b>) -> Result<Self, String>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'b> Decode<'b> for Filler {
|
||||||
|
fn decode(d: &mut Decoder<'b>) -> Result<Self, String> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ use crate::decode::Decode;
|
||||||
|
|
||||||
pub struct Decoder<'b> {
|
pub struct Decoder<'b> {
|
||||||
buffer: &'b [u8],
|
buffer: &'b [u8],
|
||||||
|
used_bits: i64,
|
||||||
pos: usize,
|
pos: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +11,7 @@ impl<'b> Decoder<'b> {
|
||||||
Decoder {
|
Decoder {
|
||||||
buffer: bytes,
|
buffer: bytes,
|
||||||
pos: 0,
|
pos: 0,
|
||||||
|
used_bits: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,11 @@ where
|
||||||
{
|
{
|
||||||
let mut d = de::Decoder::new(bytes);
|
let mut d = de::Decoder::new(bytes);
|
||||||
|
|
||||||
d.decode()
|
let value = d.decode()?;
|
||||||
|
|
||||||
|
d.decode::<filler::Filler>()?;
|
||||||
|
|
||||||
|
Ok(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Reference in New Issue