pub struct UnicodeHandler;Expand description
Unicode encoding handler for path strings
Implementations§
Source§impl UnicodeHandler
impl UnicodeHandler
Sourcepub fn detect_encoding(bytes: &[u8]) -> &'static Encoding
pub fn detect_encoding(bytes: &[u8]) -> &'static Encoding
Detect string encoding
Sourcepub fn convert_to_utf8(bytes: &[u8]) -> PathResult<String>
pub fn convert_to_utf8(bytes: &[u8]) -> PathResult<String>
Sourcepub fn convert_from_utf8(
text: &str,
target_encoding: &'static Encoding,
) -> PathResult<Vec<u8>>
pub fn convert_from_utf8( text: &str, target_encoding: &'static Encoding, ) -> PathResult<Vec<u8>>
Convert UTF-8 string to target encoding bytes
§Errors
Returns PathError if encoding conversion fails.
Sourcepub fn normalize_windows_path(path: &str) -> String
pub fn normalize_windows_path(path: &str) -> String
Normalize Windows path by removing invalid characters
Sourcepub fn normalize_unix_path(path: &str) -> String
pub fn normalize_unix_path(path: &str) -> String
Normalize Unix path by removing invalid characters
Sourcepub fn convert_path_encoding(
path: &str,
from: &'static Encoding,
to: &'static Encoding,
) -> PathResult<String>
pub fn convert_path_encoding( path: &str, from: &'static Encoding, to: &'static Encoding, ) -> PathResult<String>
Convert path encoding (mainly for Windows non-UTF-8 encodings)
§Errors
Returns PathError if encoding conversion fails.
Trait Implementations§
Source§impl Clone for UnicodeHandler
impl Clone for UnicodeHandler
Source§fn clone(&self) -> UnicodeHandler
fn clone(&self) -> UnicodeHandler
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UnicodeHandler
impl Debug for UnicodeHandler
impl Copy for UnicodeHandler
Auto Trait Implementations§
impl Freeze for UnicodeHandler
impl RefUnwindSafe for UnicodeHandler
impl Send for UnicodeHandler
impl Sync for UnicodeHandler
impl Unpin for UnicodeHandler
impl UnwindSafe for UnicodeHandler
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