-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
213 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,99 @@ | ||
struct Decoder {} | ||
use ixc_schema::decoder::DecodeError; | ||
use ixc_schema::mem::MemoryManager; | ||
use ixc_schema::structs::{StructDecodeVisitor, StructType}; | ||
|
||
struct Decoder<'a> { | ||
data: &'a [u8], | ||
} | ||
|
||
impl <'a> ixc_schema::decoder::Decoder<'a> for Decoder<'a> { | ||
fn decode_bool(&mut self) -> Result<bool, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_u8(&mut self) -> Result<u8, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_u16(&mut self) -> Result<u16, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_u32(&mut self) -> Result<u32, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_u64(&mut self) -> Result<u64, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_u128(&mut self) -> Result<u128, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_i8(&mut self) -> Result<i8, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_i16(&mut self) -> Result<i16, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_i32(&mut self) -> Result<i32, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_i64(&mut self) -> Result<i64, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_i128(&mut self) -> Result<i128, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_borrowed_str(&mut self) -> Result<&'a str, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_owned_str(&mut self) -> Result<String, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_borrowed_bytes(&mut self) -> Result<&'a [u8], DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_owned_bytes(&mut self) -> Result<Vec<u8>, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_struct(&mut self, visitor: &mut dyn StructDecodeVisitor<'a>, struct_type: &StructType) -> Result<(), DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_list(&mut self, visitor: &mut dyn ixc_schema::list::ListDecodeVisitor<'a>) -> Result<(), DecodeError> { | ||
// if it's a packed tag | ||
// decode size | ||
// for each list item | ||
// decode element | ||
// else | ||
// decode next element | ||
todo!() | ||
} | ||
|
||
fn decode_account_id(&mut self) -> Result<ixc_message_api::AccountID, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_time(&mut self) -> Result<simple_time::Time, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn decode_duration(&mut self) -> Result<simple_time::Duration, DecodeError> { | ||
todo!() | ||
} | ||
|
||
fn mem_manager(&self) -> &'a MemoryManager { | ||
todo!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,96 @@ | ||
struct Encoder {} | ||
use ixc_schema::encoder::EncodeError; | ||
use ixc_schema::structs::{StructEncodeVisitor, StructType}; | ||
use integer_encoding::VarInt; | ||
use ixc_schema::buffer::ReverseSliceWriter; | ||
|
||
struct Encoder<'a> { | ||
writer: ReverseSliceWriter<'a>, | ||
} | ||
|
||
impl <'a> ixc_schema::encoder::Encoder for Encoder<'a> { | ||
fn encode_bool(&mut self, x: bool) -> Result<(), EncodeError> { | ||
todo!() | ||
} | ||
|
||
fn encode_u8(&mut self, x: u8) -> Result<(), EncodeError> { | ||
todo!() | ||
} | ||
|
||
fn encode_u16(&mut self, x: u16) -> Result<(), EncodeError> { | ||
todo!() | ||
} | ||
|
||
fn encode_u32(&mut self, x: u32) -> Result<(), EncodeError> { | ||
todo!() | ||
} | ||
|
||
fn encode_u64(&mut self, x: u64) -> Result<(), EncodeError> { | ||
// fixed size buffer | ||
// <u64 as VarInt>::encode_var(x, &mut self.writer); | ||
todo!() | ||
} | ||
|
||
fn encode_u128(&mut self, x: u128) -> Result<(), EncodeError> { | ||
todo!() | ||
} | ||
|
||
fn encode_i8(&mut self, x: i8) -> Result<(), EncodeError> { | ||
todo!() | ||
} | ||
|
||
fn encode_i16(&mut self, x: i16) -> Result<(), EncodeError> { | ||
todo!() | ||
} | ||
|
||
fn encode_i32(&mut self, x: i32) -> Result<(), EncodeError> { | ||
todo!() | ||
} | ||
|
||
fn encode_i64(&mut self, x: i64) -> Result<(), EncodeError> { | ||
todo!() | ||
} | ||
|
||
fn encode_i128(&mut self, x: i128) -> Result<(), EncodeError> { | ||
todo!() | ||
} | ||
|
||
fn encode_str(&mut self, x: &str) -> Result<(), EncodeError> { | ||
todo!() | ||
} | ||
|
||
fn encode_bytes(&mut self, x: &[u8]) -> Result<(), EncodeError> { | ||
todo!() | ||
} | ||
|
||
fn encode_list(&mut self, visitor: &dyn ixc_schema::list::ListEncodeVisitor) -> Result<(), EncodeError> { | ||
todo!() | ||
// if it's a packed list type | ||
// for each list item in reverse order | ||
// encode element | ||
// encode size | ||
// encode tag | ||
// else | ||
// for each list item in reverse order | ||
// encode element | ||
// encode tag | ||
} | ||
|
||
fn encode_struct(&mut self, visitor: &dyn StructEncodeVisitor, struct_type: &StructType) -> Result<(), EncodeError> { | ||
// for each field in reverse order | ||
// encode field | ||
// encode tag | ||
todo!() | ||
} | ||
|
||
fn encode_account_id(&mut self, x: ixc_message_api::AccountID) -> Result<(), EncodeError> { | ||
todo!() | ||
} | ||
|
||
fn encode_time(&mut self, x: simple_time::Time) -> Result<(), EncodeError> { | ||
todo!() | ||
} | ||
|
||
fn encode_duration(&mut self, x: simple_time::Duration) -> Result<(), EncodeError> { | ||
todo!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters