2 releases

0.1.1 Mar 8, 2024
0.1.0 Jul 22, 2020

#1479 in Parser implementations

MIT/Apache

18KB
312 lines

adstxt

ci Rust Documentation Latest Version

This library provides a parser for ads.txt v1.0.2.

Example

# use adstxt::*;

assert_eq!(
    AdsTxt::parse(
        "# comment
placeholder.example.com, placeholder, DIRECT, placeholder # Comment
contact=adops@example.com

unknown"
    ),
    AdsTxt {
        records: vec![(
            Record {
                domain: "placeholder.example.com",
                account_id: "placeholder",
                relation: Relation::Direct,
                authority_id: Some("placeholder"),
            },
            None
        )],
        variables: vec![(Variable { name: "contact", value: "adops@example.com" }, None)],
    }
);

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

No runtime deps