#transparency #consent #gdpr #framework #sdk #vendor

gdpr_consent

GDPR Transparency and Consent Framework SDK for Rust

5 releases (3 breaking)

Uses old Rust 2015

0.4.0 Sep 14, 2018
0.3.0 May 22, 2018
0.2.0 May 21, 2018
0.1.1 May 15, 2018
0.1.0 May 15, 2018

#3 in #consent

MIT/Apache

23KB
525 lines

Travis Build Status AppVeyor Build status Coverage Status crates.io docs.rs

GDPR Transparency and Consent Framework SDK Rust

Example Usage

Vendor List

extern crate gdpr_consent;
extern crate reqwest;

use gdpr_consent::vendor_list::VendorList;
use std::error::Error;

fn main() -> Result<(), Box<Error>> {
    let json = reqwest::get("https://vendorlist.consensu.org/vendorlist.json")?.text()?;
    let vendor_list: VendorList = json.parse()?;

    match vendor_list.vendors.get(&32) {
        Some(appnexus) => println!("{:?}", appnexus),
        None => println!("AppNexus was not present in the vendor list."),
    }

    Ok(())
}
extern crate chrono;
extern crate gdpr_consent;

use gdpr_consent::vendor_consent::VendorConsent;
use std::error::Error;

fn main() -> Result<(), Box<Error>> {
    let vendor_consent = "BOEFEAyOEFEAyAHABDENAI4AAAB9vABAASA".parse()?;
    let VendorConsent::V1(mut v1) = vendor_consent;

    v1.last_updated = "2018-05-11T12:00:00.000Z".parse()?;
    v1.vendor_consent.remove(9); // remove consent for Vendor ID 10

    let serialized = VendorConsent::V1(v1).to_string()?;
    assert_eq!(serialized, "BOEFEAyONlzmAAHABDENAI4AAAB9vABgASABQA");

    Ok(())
}

Dependencies

~2.3–3.5MB
~64K SLoC