pub struct PlatformEncoding;
Expand description
Represents an abstraction of Encoding
that represents the current platform encoding.
This differs from NativeEncoding
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::{PlatformEncoding, UnixEncoding, WindowsEncoding};
// The platform encoding is considered a distinct type from Unix/Windows encodings.
assert_ne!(TypeId::of::<PlatformEncoding>(), TypeId::of::<UnixEncoding>());
assert_ne!(TypeId::of::<PlatformEncoding>(), TypeId::of::<WindowsEncoding>());
Trait Implementations§
Source§impl Clone for PlatformEncoding
impl Clone for PlatformEncoding
Source§fn clone(&self) -> PlatformEncoding
fn clone(&self) -> PlatformEncoding
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PlatformEncoding
impl Debug for PlatformEncoding
Source§impl Display for PlatformEncoding
impl Display for PlatformEncoding
Source§impl Encoding for PlatformEncoding
impl Encoding for PlatformEncoding
Source§type Components<'a> = <UnixEncoding as Encoding>::Components<'a>
type Components<'a> = <UnixEncoding as Encoding>::Components<'a>
Represents the type of component that will be derived by this encoding
Source§fn components(path: &[u8]) -> Self::Components<'_>
fn components(path: &[u8]) -> Self::Components<'_>
Produces an iterator of
Component
s over the given the byte slice (path
)Source§fn push(current_path: &mut Vec<u8>, path: &[u8])
fn push(current_path: &mut Vec<u8>, path: &[u8])
Pushes a byte slice (
path
) onto the an existing path (current_path
)Source§fn push_checked(
current_path: &mut Vec<u8>,
path: &[u8],
) -> Result<(), CheckedPathError>
fn push_checked( current_path: &mut Vec<u8>, path: &[u8], ) -> Result<(), CheckedPathError>
Like
Encoding::push
, but enforces several new rules: Read moreimpl Copy for PlatformEncoding
Auto Trait Implementations§
impl Freeze for PlatformEncoding
impl RefUnwindSafe for PlatformEncoding
impl Send for PlatformEncoding
impl Sync for PlatformEncoding
impl Unpin for PlatformEncoding
impl UnwindSafe for PlatformEncoding
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