Struct licensed::License[][src]

pub struct License { /* fields omitted */ }

License is the primary struct through which to interact with licensed.

static PUBLIC_KEY: &'static [u8] = include_bytes!("../examples/public.pks");
// Generally, it is suggested to read in the license from a file at runtime
let license_file: Vec<u8> = include_bytes!("../examples/license").to_vec();
let license = licensed::License::new(&license_file)
    .with_public_key(&PUBLIC_KEY)
    .build().unwrap();
if ! license.valid() {
    println!("The provided license is invalid");
    process::exit(1);
}

Methods

impl License
[src]

Creates a new builder for the license, helping to construct and validate the license.

let license = licensed::License::new(&license_file)
    .with_public_key(&PUBLIC_KEY)
    .build()?;

Is this license valid and non-expired?

assert!(license.valid());

Does this license have the specified feature?

assert!(license.has_feature("hello"));

Trait Implementations

impl Clone for License
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for License
[src]

Formats the value using the given formatter. Read more

impl Default for License
[src]

Returns the "default value" for a type. Read more

Auto Trait Implementations

impl Send for License

impl Sync for License