macro_rules! impl_to_path_to_set {
(
impl[ $($impl_params:tt)* ] $self:ty
$(where[ $($where_clause:tt)* ])?
) => (
impl< $($impl_params)* > $self
where
$($($where_clause)*)?
{
#[inline(always)]
pub const fn into_path(self) -> NestedFieldPath<(Self,)> {
NestedFieldPath::one(self)
}
#[inline(always)]
pub const fn into_set(self) -> FieldPathSet<(Self,), UniquePaths> {
FieldPathSet::one(self)
}
}
impl< $($impl_params)* > $self
where
Self: ConstDefault,
$($($where_clause)*)?
{
#[doc(hidden)]
pub const NEW_ALIASED:Self=Self::DEFAULT;
#[doc(hidden)]
pub const unsafe fn set_uniqueness(self)->Self{
self
}
}
)
}
pub trait IsTStr: Sealed + Debug + Copy + ConstDefault {}
#[doc(hidden)]
pub trait AssertTStrParam<P>: AssertTStrParamSealed<P> {}
mod is_tstr_param_sealed {
pub trait AssertTStrParamSealed<P> {}
}
use is_tstr_param_sealed::AssertTStrParamSealed;
impl<This: ?Sized, P> AssertTStrParamSealed<TStr<P>> for This {}
impl<This: ?Sized, P> AssertTStrParam<TStr<P>> for This {}
impl<T> IsTStr for TStr<T> {}
impl<T> Debug for TStr<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("TStr").finish()
}
}
impl<T> TStr<T> {
pub const NEW: Self = TStr(PhantomData);
}
impl_to_path_to_set! {
impl[T] TStr<T>
}
impl<T> IsSingleFieldPath for TStr<T> {}
unsafe impl<T> ShallowFieldPath for TStr<T> {}
impl<T> IsMultiFieldPath for TStr<T> {
type PathUniqueness=UniquePaths;
}
impl<T> Copy for TStr<T> {}
impl<T> Clone for TStr<T> {
#[inline(always)]
fn clone(&self) -> Self {
*self
}
}
impl<T> ConstDefault for TStr<T> {
const DEFAULT: Self = TStr(PhantomData);
}
impl<T> ToTString for TStr<T> {
type Output = Self;
}
impl_cmp_traits! {
impl[T] TStr<T>
where[]
}
impl<V, F> VariantField<V, F>
where
V: ConstDefault,
F: ConstDefault,
{
pub const NEW: Self = ConstDefault::DEFAULT;
}
impl_to_path_to_set! {
impl[V,F] VariantField<V,F>
}
impl<V, F> VariantField<V, F> {
pub const fn new(variant: V, field: F) -> Self {
Self { variant, field }
}
}
impl<V, F> IsSingleFieldPath for VariantField<V, F> {}
unsafe impl<V, F> ShallowFieldPath for VariantField<V, F> {}
impl<V, F> IsMultiFieldPath for VariantField<V, F> {
type PathUniqueness=UniquePaths;
}
impl<T, U> Debug for VariantField<T, U> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("VariantField").finish()
}
}
impl<V, F> ConstDefault for VariantField<V, F>
where
V: ConstDefault,
F: ConstDefault,
{
const DEFAULT: Self = Self {
variant: ConstDefault::DEFAULT,
field: ConstDefault::DEFAULT,
};
}
impl_cmp_traits! {
impl[V,F] VariantField<V,F>
where[]
}
impl<V> VariantName<V>
where
V: ConstDefault,
{
pub const NEW: Self = Self::DEFAULT;
}
impl_to_path_to_set! {
impl[V] VariantName<V>
}
impl<V> VariantName<V> {
pub fn new(name: V) -> Self {
Self { name }
}
}
impl<V> IsSingleFieldPath for VariantName<V> {}
impl<T> IsMultiFieldPath for VariantName<T> {
type PathUniqueness=UniquePaths;
}
impl<T> Debug for VariantName<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("VariantName").finish()
}
}
impl<V> ConstDefault for VariantName<V>
where
V: ConstDefault,
{
const DEFAULT: Self = VariantName {
name: ConstDefault::DEFAULT,
};
}
impl_cmp_traits! {
impl[T] VariantName<T>
where[]
}