murdoch-charsets

Crates.iomurdoch-charsets
lib.rsmurdoch-charsets
version0.1.0
sourcesrc
created_at2019-07-13 03:30:08.566647
updated_at2019-07-13 03:30:08.566647
descriptionprovides character-sets type defined by IANA
homepage
repositoryhttps://github.com/arkhe634/murdoch
max_upload_size
id148671
size53,499
arkhe (arkhe634)

documentation

https://docs.rs/murdoch-charsets

README

crate-name at crates.io crate-name at docs.rs

murdoch-charsets

Murdoch-Charsets

murdoch-charsets provides API for name of character sets defined by Internet Assigned Numbers Authority (IANA).

In all settings, murdoch-charset provides CharacterSet traits and InvalidCharacterSetNameError.

Default Setting

By default, murdoch-charsets provides types corresponding character sets defined by IANA, and CharacterSetEnum to hold any of them.

Custom Character-Sets

You can customize the character sets by using no_charset feature

[dependencies]
murdoch-charsets = { features = [ "no_charset" ] }

then murdoch-charsets exports character_sets! macro.

character_sets!(
    UnicodeCharacterSet,
    UTF_8,                           // character-set type/variant name
    None,                            // preferred_mime_name
    "UTF-8",                         // name
    ["UTF8", "UTF_8",],              // aliases
    ["UTF-8", "UTF8", "UTF_8",],     // uppercase set of names (for FromStr)
    UTF_16,
    None,
    "UTF-16",
    ["UTF16", "UTF_16",],
    ["UTF-16", "UTF16", "UTF_16",],
    UTF_32,
    None,
    "UTF-32",
    ["UTF32", "UTF_32",],
    ["UTF-32", "UTF32", "UTF_32",],
);

By calling the macro as above, the following types and implementations of traits (Debug, Display, Copy, Clone, PartialEq, Eq, FromStr, AsRef<str>, AsRef<[u8]>) are generated.

pub struct UTF_8;
pub struct UTF_16;
pub struct UTF_32;
pub enum UnicodeCharacterSet
{
    UTF_8,
    UTF_16,
    UTF_32,
}

License: MIT

Commit count: 4

cargo fmt