No description
Find a file
2024-02-04 11:42:48 +01:00
.github CI: Update required Rust versions 2024-02-03 09:56:37 +01:00
fuzz More lints 2024-02-03 10:39:04 +01:00
src Convert scanning functions to methods on Scanner 2024-02-04 11:42:48 +01:00
tests More lints 2024-02-03 10:39:04 +01:00
.gitignore Add parser fuzz target 2022-07-08 12:54:44 -07:00
Cargo.toml Fix license 2024-02-04 09:00:36 +01:00
LICENSE-MIT MIT license 2022-07-03 07:58:18 -07:00
README.md Update README, doc links 2024-02-04 09:02:16 +01:00

libyaml-safer

github crates.io docs.rs build status

This library is a fork of unsafe-libyaml translated to safe and idiomatic Rust.

unsafe-libyaml is libyaml translated from C to unsafe Rust with the assistance of c2rust.

[dependencies]
libyaml-safer = "0.1"

Compiler support: requires rustc 1.70

Notes

This library uses the same test suite as unsafe-libyaml, which is also the "official" test suite for libyaml. The library was ported line by line, function by function, from unsafe-libyaml, with the aim of precisely matching its behavior, including performance and allocation patterns. Any observable difference in behavior, outside of API differences due to Rust conventions, is considered a bug.

One notable exception to the above is that this library uses the Rust standard library in place of custom routines where possible. For example, most UTF-8 and UTF-16 encoding and decoding is handled by the standard library, and input/output callbacks are replaced with the applicable std::io::* traits. Due to the use of std::io, this library cannot currently be no_std.

Memory allocation patterns are generally preserved, except that standard library containers may overallocate buffers using different heuristics.

In places where libyaml routines are replaced by the standard library, certain errors may be reported with reduced fidelity compared with libyaml (e.g., error messages may look slightly different), but the same inputs should generate the same general errors.

This library introduces no new dependencies except for thiserror for convenience. This dependency may go away in the future.

Compatibility and interoperability

While this library matches the behavior of libyaml, it is not intended as a drop-in replacement. The shape of the API is idiomatic Rust, and while it is possible to emulate the C API using this library, supporting this use case is not a priority. Use unsafe-libyaml if that is what you need.

License

MIT license, same as unsafe-libyaml and libyaml.