Trait zifu::filename_decoder::IDecoder[][src]

pub trait IDecoder {
    fn to_string_lossless(&self, input: &Vec<u8>) -> Option<String>;
fn to_string_lossy(&self, input: &Vec<u8>) -> String;
fn encoding_name(&self) -> &str;
fn color(&self) -> Color; }

Trait (interface) of decoder

Required methods

fn to_string_lossless(&self, input: &Vec<u8>) -> Option<String>[src]

Converts to UTF-8 String only if possible completely

Arguments

  • input - sequence of bytes that may represent a string

fn to_string_lossy(&self, input: &Vec<u8>) -> String[src]

Converts to UTF-8 String by force (filling with replacement characters)

Arguments

  • input - sequence of bytes that may represent a string

fn encoding_name(&self) -> &str[src]

Returns the name of the encoding that the decoder uses

fn color(&self) -> Color[src]

Returns enumerates ansi_term::Color

Green -> desirable / Red -> undesirable

Loading content...

Implementations

impl dyn IDecoder[src]

pub fn utf8() -> Box<dyn IDecoder>[src]

Returns UTF-8 decoder

pub fn ascii() -> Box<dyn IDecoder>[src]

Returns ASCII decoder

pub fn native_oem_encoding() -> Box<dyn IDecoder>[src]

Returns native OEM code pages for the current locale

Supported: CJKV / Thai / IBM OEM

pub fn from_encoding_name(name: &str) -> Option<Box<dyn IDecoder>>[src]

Generates an instance of a decoder from encoding name (e.g. sjis -> Shift-JIS)

Arguments

  • name - encoding name

Implementors

Loading content...