pub struct EncodingType(/* private fields */);Expand description
Represents the text encoding that the caller uses to process the output.
Providing an EncodingType is recommended because the API provides the
beginning offsets for various outputs, such as tokens and mentions, and
languages that natively use different text encodings may access offsets
differently.
Implementations§
Source§impl EncodingType
impl EncodingType
Sourcepub const NONE: EncodingType
pub const NONE: EncodingType
If EncodingType is not specified, encoding-dependent information (such as
begin_offset) will be set at -1.
Sourcepub const UTF8: EncodingType
pub const UTF8: EncodingType
Encoding-dependent information (such as begin_offset) is calculated based
on the UTF-8 encoding of the input. C++ and Go are examples of languages
that use this encoding natively.
Sourcepub const UTF16: EncodingType
pub const UTF16: EncodingType
Encoding-dependent information (such as begin_offset) is calculated based
on the UTF-16 encoding of the input. Java and JavaScript are examples of
languages that use this encoding natively.
Sourcepub const UTF32: EncodingType
pub const UTF32: EncodingType
Encoding-dependent information (such as begin_offset) is calculated based
on the UTF-32 encoding of the input. Python is an example of a language
that uses this encoding natively.
Sourcepub fn as_str_name(&self) -> Cow<'static, str>
pub fn as_str_name(&self) -> Cow<'static, str>
Gets the enum value as a string.
Sourcepub fn from_str_name(name: &str) -> Option<Self>
pub fn from_str_name(name: &str) -> Option<Self>
Creates an enum value from the value name.
Trait Implementations§
Source§impl Clone for EncodingType
impl Clone for EncodingType
Source§fn clone(&self) -> EncodingType
fn clone(&self) -> EncodingType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more