#iab #unknown #adstxt

adstxt

This library provides a parser for ads.txt

1 unstable release

0.1.0 Jul 22, 2020

#5 in #iab

43 downloads per month

MIT/Apache

21KB
526 lines

adstxt

ci Rust Documentation Latest Version

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

Example

assert_eq!(
    parse_adstxt(
        "# comment
placeholder.example.com, placeholder, DIRECT, placeholder
contact=adops@example.com

unknown"
    )
    .unwrap(),
    AdsTxt {
        records: vec![Record {
            domain: "placeholder.example.com",
            account_id: "placeholder",
            relation: Relation::Direct,
            authority_id: Some("placeholder"),
        }],
        variables: {
            let mut map = HashMap::new();
            map.insert("contact", vec!["adops@example.com"]);
            map
        },
    }
);

License

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

Dependencies

~0.4–13MB
~142K SLoC