reserde
A Serde-based document converter.
Installation
You can install reserde using Cargo:
cargo install reserde
Usage
Usage: reserde.exe [--if <if>] [--of <of>] -i <in> -o <out> [-p] [-s <stringify...>] [--enum-bools]
Transcode a self-describing format into a different format. Currently supports Bencode, Bincode (--out only), CBOR, JSON (--pretty), TAML (--in only), XML, x-www-form-urlencoded (as urlencoded) and YAML. All names are lowercase.
Options:
--if where to read input from. Defaults to stdin
--of where to write output to. Defaults to stdout
-i, --in what to read
-o, --out what to write
-p, --pretty pretty-print (where supported)
-s, --stringify stringify bytes and non-string value keys into strings where
possible, possible values are: utf8. (Tries encodings in the
order specified.) [try with: --in bencode]
--enum-bools case-insensitively convert unit variants with name `true` or
`false` into booleans.
--help display usage information
Examples
Converting a .torrent file
Output (excerpt):
TAML to YAML
# [soundscapes]
// Sewer
## [[loops].{sound, volume}]
"$sewer/amb_drips", 0.8
"$sewer/amb_flies", 0.1
"$sewer/amb_hum", 0.05 // postfix comment
## [moments]
sound: "$sewer/moments/*"
layers: 1
first-interval-no-min: true
interval-range: (10, 60)
volume-range: (0.1, 0.15)
`spaced \` identifier`: "asdhasd kjhdajkh"
---
soundscapes:
- loops:
- sound: $sewer/amb_drips
volume: 0.8
- sound: $sewer/amb_flies
volume: 0.1
- sound: $sewer/amb_hum
volume: 0.05
moments:
- sound: $sewer/moments/*
layers: 1
first-interval-no-min: true
interval-range:
- 10
- 60
volume-range:
- 0.1
- 0.15
"spaced ` identifier": asdhasd kjhdajkh
(Comments are generally stripped, as they can't be sent across Serde's interface.)
TAML to XML
# [enums]: Structured
field_1: true
field_2: false
# [[enums]]
Tuple(1, 2, 3)
Unit
EmptyTuple()
123
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Code of Conduct
Changelog
Versioning
reserde strictly follows Semantic Versioning 2.0.0 with the following exceptions:
- The minor version will not reset to 0 on major version changes (except for v1).
Consider it the global feature level. - The patch version will not reset to 0 on major or minor version changes (except for v0.1 and v1).
Consider it the global patch level.
This includes the Rust version requirement specified above.
Earlier Rust versions may be compatible, but this can change with minor or patch releases.
Which versions are affected by features and patches can be determined from the respective headings in CHANGELOG.md.