Releases: moreal/bencodex-rs
Releases Β· moreal/bencodex-rs
Release 0.5.1
Release 0.5.0
Note
It skipped 0.4.0 version for tests. π 0.5.0 is the next version of 0.3.1
Full Changelog: 0.3.1...0.5.0
Support Bencodex JSON
Since 0.5.0, it provides Bencodex JSON-related features. You can enable the feature with json feature flag. Then you can use the functions like bencodex::json::from_json_string, bencodex::json::to_json.
use bencodex::{ BencodexValue, json::to_json };
let json = to_json(&BencodexValue::Null);
println!("{}", json);// from_json_string
use bencodex::{ BencodexValue, json::from_json_string };
let result = from_json_string("null");
assert!(result.is_ok());
assert_eq!(result.unwrap(), BencodexValue::Null);Support Bencodex JSON CLI tool
It started to provide CLI tool to encode and decode between Bencodex and JSON.
# encode
$ echo -n 'n' | bencodex
null
$ echo -n 'i123e' | bencodex
"123"
$ echo -n '1:\x12' | bencodex
"0x12"
$ echo -n '1:\x12' | bencodex --base64
"b64:Eg=="
# decode
$ echo -n '"123"' | bencodex -d
123
$ echo -n 'null' | bencodex -d
n0.3.0
Added APIs
- All
BencodexValuetypes andBencodexKeytypes become to implementFrom<T>trait.From<&str>forBencodexKey.From<String>forBencodexKey.From<&[u8]>forBencodexKey.From<Vec<u8>>forBencodexKey.From<&str>forBencodexValue.From<String>forBencodexValue.From<u16>forBencodexValue.From<u32>forBencodexValue.From<u64>forBencodexValue.From<i8>forBencodexValue.From<i16>forBencodexValue.From<i32>forBencodexValue.From<i64>forBencodexValue.From<bool>forBencodexValue.From<BTreeMap<T: Into<BencodexKey>, U: Into<BencodexValue>>>forBencodexValue.From<Vec<T: Into<BencodexValue>>>forBencodexValue.From<()>forBencodexValue.
BencodexDictionarytype alias was added.BencodexListtype alias was added.BENCODEX_NULLconstant was added.