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

pub trait IDecoder {
    fn to_string_lossless(&self, input: &[u8]) -> Option<String>;
fn to_string_lossy(&self, input: &[u8]) -> String;
fn encoding_name(&self) -> &str; fn can_decode(&self, input: &[u8]) -> bool { ... } }
Expand description

Trait (interface) of decoder

Required methods

Converts to UTF-8 String only if possible completely

Arguments

  • input - sequence of bytes that may represent a string

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

Arguments

  • input - sequence of bytes that may represent a string

Returns the name of the encoding that the decoder uses

Provided methods

Returns true if input is valid sequence for encoding

Arguments

  • input - sequence of bytes that may represent a string

Implementations

Returns UTF-8 decoder

Returns ASCII decoder

Returns native OEM code pages for the current locale

Supported: CJKV / Thai / IBM OEM

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

Arguments

  • name - encoding name

Implementors