pub struct SpezEmpty<T: ?Sized>(/* private fields */);Expand description
A wrapper type used for auto-deref specialization.
This struct is a core part of the auto-deref-based specialization technique which allows
conditionally implementing functionality based on what traits a type implements, without
requiring the unstable specialization feature.
Unlike Spez, SpezEmpty wraps a type instead of a value. It is used in conjunction with
trait implementations that leverage Rust’s method resolution rules to select different
implementations based on available traits.
Implementations§
Trait Implementations§
Source§impl<T: ?Sized> SpezDefaultInPlaceNo for SpezEmpty<T>
impl<T: ?Sized> SpezDefaultInPlaceNo for SpezEmpty<T>
Source§impl<T: Default> SpezDefaultInPlaceYes for &SpezEmpty<T>
impl<T: Default> SpezDefaultInPlaceYes for &SpezEmpty<T>
Source§impl<T: ?Sized> SpezParseNo for SpezEmpty<T>
impl<T: ?Sized> SpezParseNo for SpezEmpty<T>
Source§unsafe fn spez_parse(
&self,
_s: &str,
_target: PtrUninit,
) -> Result<PtrMut, ParseError>
unsafe fn spez_parse( &self, _s: &str, _target: PtrUninit, ) -> Result<PtrMut, ParseError>
Fallback implementation when the type doesn’t implement
FromStr. Read moreSource§impl<T: FromStr> SpezParseYes for &SpezEmpty<T>
impl<T: FromStr> SpezParseYes for &SpezEmpty<T>
Source§unsafe fn spez_parse(
&self,
s: &str,
target: PtrUninit,
) -> Result<PtrMut, ParseError>
unsafe fn spez_parse( &self, s: &str, target: PtrUninit, ) -> Result<PtrMut, ParseError>
Parses a string slice into the inner type. Read more
Auto Trait Implementations§
impl<T> Freeze for SpezEmpty<T>where
T: ?Sized,
impl<T> RefUnwindSafe for SpezEmpty<T>where
T: ?Sized,
impl<T> Send for SpezEmpty<T>where
T: ?Sized,
impl<T> Sync for SpezEmpty<T>where
T: ?Sized,
impl<T> Unpin for SpezEmpty<T>where
T: ?Sized,
impl<T> UnwindSafe for SpezEmpty<T>where
T: ?Sized,
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