pub struct Utf8PlatformEncoding;
Expand description
Represents an abstraction of Utf8Encoding
that represents the current platform
encoding.
This differs from Utf8NativeEncoding
in that it is its own struct instead of a type
alias to the platform-specific encoding, and can therefore be used to enforce more strict
compile-time checks of encodings without needing to leverage conditional configs.
§Examples
use core::any::TypeId;
use typed_path::{Utf8PlatformEncoding, Utf8UnixEncoding, Utf8WindowsEncoding};
// The UTF8 platform encoding is considered a distinct type from UTF8 Unix/Windows encodings.
assert_ne!(TypeId::of::<Utf8PlatformEncoding>(), TypeId::of::<Utf8UnixEncoding>());
assert_ne!(TypeId::of::<Utf8PlatformEncoding>(), TypeId::of::<Utf8WindowsEncoding>());
Trait Implementations§
Source§impl Clone for Utf8PlatformEncoding
impl Clone for Utf8PlatformEncoding
Source§fn clone(&self) -> Utf8PlatformEncoding
fn clone(&self) -> Utf8PlatformEncoding
Returns a copy 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 Utf8PlatformEncoding
impl Debug for Utf8PlatformEncoding
Source§impl Display for Utf8PlatformEncoding
impl Display for Utf8PlatformEncoding
Source§impl Utf8Encoding for Utf8PlatformEncoding
impl Utf8Encoding for Utf8PlatformEncoding
Source§type Components<'a> = <Utf8UnixEncoding as Utf8Encoding>::Components<'a>
type Components<'a> = <Utf8UnixEncoding as Utf8Encoding>::Components<'a>
Represents the type of component that will be derived by this encoding
Source§fn components(path: &str) -> Self::Components<'_>
fn components(path: &str) -> Self::Components<'_>
Produces an iterator of
Utf8Component
s over the given the byte slice (path
)Source§fn push(current_path: &mut String, path: &str)
fn push(current_path: &mut String, path: &str)
Pushes a utf8 str (
path
) onto the an existing path (current_path
)Source§fn push_checked(
current_path: &mut String,
path: &str,
) -> Result<(), CheckedPathError>
fn push_checked( current_path: &mut String, path: &str, ) -> Result<(), CheckedPathError>
Like
Utf8Encoding::push
, but enforces several new rules: Read moreimpl Copy for Utf8PlatformEncoding
Auto Trait Implementations§
impl Freeze for Utf8PlatformEncoding
impl RefUnwindSafe for Utf8PlatformEncoding
impl Send for Utf8PlatformEncoding
impl Sync for Utf8PlatformEncoding
impl Unpin for Utf8PlatformEncoding
impl UnwindSafe for Utf8PlatformEncoding
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