chore: slight clean up
This commit is contained in:
parent
83a784c745
commit
3f1ddef635
|
@ -1 +1,2 @@
|
||||||
/target
|
/target
|
||||||
|
*.flat
|
|
@ -7,6 +7,7 @@ pub trait Decode<'b>: Sized {
|
||||||
impl Decode<'_> for Filler {
|
impl Decode<'_> for Filler {
|
||||||
fn decode(d: &mut Decoder) -> Result<Filler, String> {
|
fn decode(d: &mut Decoder) -> Result<Filler, String> {
|
||||||
d.filler()?;
|
d.filler()?;
|
||||||
|
|
||||||
Ok(Filler::FillerEnd)
|
Ok(Filler::FillerEnd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,7 @@ impl Encode for &[u8] {
|
||||||
impl<T: Encode> Encode for Box<T> {
|
impl<T: Encode> Encode for Box<T> {
|
||||||
fn encode(&self, e: &mut Encoder) -> Result<(), String> {
|
fn encode(&self, e: &mut Encoder) -> Result<(), String> {
|
||||||
self.as_ref().encode(e)?;
|
self.as_ref().encode(e)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ pub enum Term {
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum Constant {
|
pub enum Constant {
|
||||||
// TODO: figure out the right size for this
|
|
||||||
// tag: 0
|
// tag: 0
|
||||||
Integer(isize),
|
Integer(isize),
|
||||||
// tag: 1
|
// tag: 1
|
||||||
|
|
|
@ -261,6 +261,7 @@ mod test {
|
||||||
let flat_encoded = vec![
|
let flat_encoded = vec![
|
||||||
0b00001011, 0b00010110, 0b00100001, 0b01001000, 0b00000101, 0b10000001,
|
0b00001011, 0b00010110, 0b00100001, 0b01001000, 0b00000101, 0b10000001,
|
||||||
];
|
];
|
||||||
|
|
||||||
let expected_program = Program {
|
let expected_program = Program {
|
||||||
version: (11, 22, 33),
|
version: (11, 22, 33),
|
||||||
term: Term::Constant(Constant::Integer(11)),
|
term: Term::Constant(Constant::Integer(11)),
|
||||||
|
|
Loading…
Reference in New Issue