Skip to content

Releases: bencodex/bencodex-rs

Release 0.5.0

04 Jul 01:20
Compare
Choose a tag to compare

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
n

0.3.0

02 Nov 10:53
Compare
Choose a tag to compare

Added APIs

  • All BencodexValue types and BencodexKey types become to implement From<T> trait.
    • From<&str> for BencodexKey.
    • From<String> for BencodexKey.
    • From<&[u8]> for BencodexKey.
    • From<Vec<u8>> for BencodexKey.
    • From<&str> for BencodexValue.
    • From<String> for BencodexValue.
    • From<u16> for BencodexValue.
    • From<u32> for BencodexValue.
    • From<u64> for BencodexValue.
    • From<i8> for BencodexValue.
    • From<i16> for BencodexValue.
    • From<i32> for BencodexValue.
    • From<i64> for BencodexValue.
    • From<bool> for BencodexValue.
    • From<BTreeMap<T: Into<BencodexKey>, U: Into<BencodexValue>>> for BencodexValue.
    • From<Vec<T: Into<BencodexValue>>> for BencodexValue.
    • From<()> for BencodexValue.
  • BencodexDictionary type alias was added.
  • BencodexList type alias was added.
  • BENCODEX_NULL constant was added.