pub fn new<'a>(input: &'a [u8]) -> LicenseBuilder<'a> {
        let mut lb = LicenseBuilder::default();
        match input.iter().position(|&r| r == 0x00) {
            Some(split_index) => {
                let (text, mut sig) = input.split_at(split_index);
                if let Ok(text) = str::from_utf8(text) {
                    lb.text = Some(text);
                }
                lb.signature = Some(&sig[1..]);
            },
            None => {}
        }

        lb
    }
/// Creates a new builder for the license, helping to construct and
/// validate the license.
/// ```
/// # use licensed::Error;
/// # static PUBLIC_KEY: &'static [u8] = include_bytes!("../examples/public.pks");
/// # fn main() { let _ = call(); }
/// # fn call() -> Result<(), Error> {
/// # let license_file: Vec<u8> = include_bytes!("../examples/license").to_vec();
/// let license = licensed::License::new(&license_file)
///     .with_public_key(&PUBLIC_KEY)
///     .build()?;
/// #   Ok(())
/// # }
/// ```
Creates a new builder for the license, helping to construct and
validate the license.
Creates a new builder for the license helping to construct and validate the license .
pub fn new<'a>(input: &'a [u8]) -> LicenseBuilder<'a> {
        let mut lb = LicenseBuilder::default();
        match input.iter().position(|&r| r == 0x00) {
            Some(split_index) => {
                let (text, mut sig) = input.split_at(split_index);
                if let Ok(text) = str::from_utf8(text) {
                    lb.text = Some(text);
                }
                lb.signature = Some(&sig[1..]);
            },
            None => {}
        }
        lb
    }
pub fn new < ' a > ( input : & ' a [ u8 ] ) -> LicenseBuilder < ' a > { let mut lb = LicenseBuilder :: default ( ) ; match input . iter ( ) . position ( | & r | r == 0x00 ) { Some ( split_index ) => { let ( text , mut sig ) = input . split_at ( split_index ) ; if let Ok ( text ) = str :: from_utf8 ( text ) { lb . text = Some ( text ) ; } lb . signature = Some ( & sig [ 1 .. ] ) ; } , None => { } } lb }
Creates a new builder for the license, helping to construct and
validate the license.
Creates a new builder for the license helping to construct and validate the license .
input
&'a [u8]
input
&'a [u8]
use licensed::error;
None
static public_key: &'static [u8] = include_bytes!("../examples/public.pks");
None
fn main() { let _ = call(); }
None
fn call() -> result<(), error> {
None
let license_file: vec<u8> = include_bytes!("../examples/license").to_vec();
let license = licensed::License::new(&license_file)
.with_public_key(&PUBLIC_KEY)
.build()?.
let license = licensed :: License :: new ( &license_file ) . with_public_key ( &PUBLIC_KEY ) . build () ? .
ok(())
None
}
None