docs.rs failed to build kson-rs-0.4.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Rust bindings for kson-lib API
The Rust bindings for KSON are split into two crates, following the convention in the Rust ecosystem:
kson-sys: the low-level interface to the native library (you probably don't need to use it directly)kson-rs: the idiomatic wrapper around kson (what you are probably looking for, see the example below)
Example usage
Add the library to your dependencies:
Write some code:
use ;
use Read;
KSON is a superset of JSON, so this accepts either. Piping JSON in:
|
prints the equivalent document in KSON's plain format:
key:
- 1
- 2
- 3
- 4
nested:
a: true
Obtaining kson-lib binaries
The kson-sys crate requires linking to the kson-lib binary. Our build.rs automatically
downloads a suitable binary from the kson-binaries
repository, if it can be found. In case no pre-built
binary is available for your platform, you need to manually specify how to obtain it through one of
the following environment variables:
KSON_ROOT_SOURCE_DIR: if set to the root of a KSON source tree, we will attempt to build and use the necessary binaries from there.KSON_PREBUILT_BIN_DIR: use pre-built KSON binaries from the specified directory.
Troubleshooting
- If the KSON library is not found at runtime, build with
KSON_COPY_SHARED_LIBRARY_TO_DIR=target/debugto place it next to your binary, and add that directory to your loader path (DYLD_LIBRARY_PATHon macOS,LD_LIBRARY_PATHon Linux). - If macOS reports
library load disallowed by system policyfor a library you supplied yourself, clear its quarantine flag:xattr -c /path/to/libkson.dylib.