Releases: webmaster128/anybuf
v0.5.2
v0.5.1
- Move repo to https://github.com/webmaster128/anybuf
- Derive
PartialEq
for errors (#23)
0.5.0
0.4.0
append_repeated_string got a generic element types
The list type of append_repeated_string
changed from &[&str]
to &[S]
with the generic list element type S: AsRef<str>
. This supports all previous types and many more. Especially owned string lists like Vec<String>
can now be used directly:
let owned: Vec<String> = vec![
"green".to_string(),
"orange".to_string(),
];
let serialized = Anybuf::new()
.append_repeated_string(4, &owned)
.into_vec();
Before 0.4.0 you had to create a new list of references in order to call append_repeated_string
.
In some cases you need to add an explicit generic type because the type can't be inferred anymore:
let data = Anybuf::new()
.append_string(1, "no messages")
- .append_repeated_string(9, &[]);
+ .append_repeated_string::<&str>(9, &[]);
append_repeated_bytes got a generic element types
The list type of append_repeated_bytes
changed from &[&[u8]]
to &[B]
with the generic list element type B: AsRef<[u8]>
. This supports all previous types and many more. Especially owned data lists like Vec<Vec<u8>>
can now be used directly:
let owned: Vec<Vec<u8>> = vec![
vec![1u8; 10],
vec![2u8; 10],
vec![3u8; 10],
];
let serialized = Anybuf::new()
.append_repeated_bytes(5, &owned)
.into_vec();
Before 0.4.0 you had to create a new list of slice references in order to call append_repeated_bytes
.
In some cases you need to add an explicit generic type because the type can't be inferred anymore:
let data = Anybuf::new()
.append_string(1, "no messages")
- .append_repeated_bytes(10, &[]);
+ .append_repeated_bytes::<&[u8]>(10, &[]);
append_repeated_message get a generic element types
The list type of append_repeated_message
changed from &[&Anybuf]
to &[M]
with the generic list element type M: AsRef<Anybuf>
. This supports all previous types and many more. Especially owned data lists like Vec<Anybuf>
can now be used directly:
let owned: Vec<Anybuf> = vec![
Anybuf::new().append_uint32(1, 1),
Anybuf::new().append_uint32(1, 2),
Anybuf::new().append_uint32(1, 3),
];
let serialized = Anybuf::new()
.append_repeated_message(11, &owned)
.into_vec();
Before 0.4.0 you had to create a new list of references in order to call append_repeated_message
.
In some cases you need to add an explicit generic type because the type can't be inferred anymore:
let data = Anybuf::new()
.append_string(1, "no messages")
- .append_repeated_message(11, &[]);
+ .append_repeated_message::<&Anybuf>(11, &[]);
v0.3.0
v0.2.0
Repeated
Add support for repeated fields through the new append_repeated_*
functions. The approach promoted in version 0.1.0 was flawed as it led to default values being skipped (0s, "", empty bytes, default messages, false).
sint32/sint64
Add signed integer support (only sint32/sint64, not int32/int64):
append_sint32
append_sint64
append_repeated_sint32
append_repeated_sint64