pub struct Unsigned;
Expand description

Determine if a char is a valid identifier for a parser and/or lexer according to Unicode Standard Annex #31 rules.


use comprez::Unsigned;

fn main() {
    let num = 1234u32;

    let compressed = Unsigned::compress_61_439(num).unwrap();
    let decompressed = Unsigned::decompress_61_439(compressed.to_vec()).unwrap();

    println!("size before compression: {}", num.to_be_bytes().len());
    //size before compression: 4

    println!("size after compression: {}", compressed.len());
    //size after compression: 2

    println!("{}", decompressed == num);
    //true
}

features

unicode-xid supports a no_std feature. This eliminates dependence on std, and instead uses equivalent functions from core.

unsigned only compression

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.