Skip to content

blck-snwmn/protowirers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

195 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

protowirers

test suite

sampel to encode/decode binary wire format for protocol buffer messages

Example

Struct

Specify Proto

#[derive(Proto, Default, Clone)]
struct Sample {
    #[def(field_num = 1, def_type = "sint64")]
    s_sint64: i64,
    #[def(field_num = 2, def_type = "fixed64")]
    f_fixed64: u64,
    #[def(field_num = 3, def_type = "string")]
    s_string: String,
    #[def(field_num = 4, def_type = "fixed32")]
    f_fixed32: u32,
    #[def(field_num = 5, def_type = "uint32", packed, repeated)]
    r_u_int32: Vec<u32>,
}

Implement the following function

fn parse(bytes: &[u8]) -> protowirers::Result<Self> {}
fn bytes(&self) -> protowirers::Result<Vec<u8>> {}

Enum

Specify Proto Last Variants must be tupple to have 1 args(i32).

#[derive(Proto, Clone, Copy, PartialEq, Eq, Debug)]
enum TestEnum {
    Value1,
    Value2,
    Value3,
    ValueOther(i32),
}

About

encode/decode binary wire format for protocol buffer messages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages