#json-text #serde-json #text-content #matching #generic #coercion #verification

libcoerced

A library for serde_json and generic text content matching, verification and coercion

3 releases

0.1.2 Aug 18, 2024
0.1.1 Aug 18, 2024
0.1.0 Aug 18, 2024

#551 in Text processing

Download history 311/week @ 2024-08-15 38/week @ 2024-08-22 2/week @ 2024-08-29 28/week @ 2024-09-12 25/week @ 2024-09-19 27/week @ 2024-09-26 3/week @ 2024-10-03

83 downloads per month
Used in lest

WTFPL license

8KB
169 lines

libcoerced

libcoerced provides reasonably advanced json/text matching and coercion for Rust.
It's simple to use and uses serde_json under the hood.

Example

JSON Verification

use libcoerced::json;

let json = json::Json::Object(Box::new([
    ("hello", Box::new(
        json::Json::StringLiteral("world")
    ))
]));
let data = serde_json::json!({
    "hello": "world"
});
assert!(json::json_verify(Box::new(json), data));

Text Verification

use libcoerced::generic::Text;

let text = "hello";
let op = Text::Equals("hello");
assert!(generic::text_verify(&op, text));

Dependencies

~0.5–1MB
~20K SLoC