Struct rust_icu_ucnv::utf8::Converter
source · pub struct Converter { /* private fields */ }
Expand description
This is a convenience type that provides conversion functions directly to/from UTF-8.
This type wraps around ucnv_convertEx
. It keeps two converters for the specified encoding and for
UTF-8, as well as the UTF-16 pivot buffers used by ucnv_convertEx
.
Its interface is analogous to the interface of UConverter, so for examples and more detailed information on its use, refer to the documentation page of UConverter.
For convenience, the single-string conversion functions take a &str
for UTF-8 input and
give a String
for UTF-8 output.
Implementations§
source§impl Converter
impl Converter
pub fn open(name: &str) -> Result<Self, Error>
pub fn try_clone(&self) -> Result<Self, Error>
pub fn has_ambiguous_mappings(&self) -> bool
pub fn name(&self) -> Result<&str, Error>
pub fn reset(&mut self)
pub fn reset_to_utf8(&mut self)
pub fn reset_from_utf8(&mut self)
pub fn feed_to_utf8(&mut self, dst: &mut [u8], src: &[u8]) -> FeedResult
pub fn feed_from_utf8(&mut self, dst: &mut [u8], src: &[u8]) -> FeedResult
pub fn convert_to_utf8(&mut self, src: &[u8]) -> Result<String, Error>
pub fn convert_from_utf8(&mut self, src: &str) -> Result<Vec<u8>, Error>
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Converter
impl !Sync for Converter
impl Unpin for Converter
impl UnwindSafe for Converter
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more