Skip to main content

S

Struct S 

Source
pub struct S<N>(pub PhantomData<N>);
Expand description

Type-level successor. S<N> represents N + 1.

§Examples

use reflect_nat::{Z, S};
use reify_reflect_core::{Reflect, RuntimeValue};

type One = S<Z>;
type Two = S<S<Z>>;
assert_eq!(One::reflect(), RuntimeValue::Nat(1));
assert_eq!(Two::reflect(), RuntimeValue::Nat(2));

Tuple Fields§

§0: PhantomData<N>

Trait Implementations§

Source§

impl<M, N> Add<N> for S<M>
where M: Nat + Add<N>, N: Nat, <M as Add<N>>::Result: Nat,

Source§

type Result = S<<M as Add<N>>::Result>

The resulting type-level natural.
Source§

impl<N> Clone for S<N>
where N: Clone,

Source§

fn clone(&self) -> S<N>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<N> Debug for S<N>
where N: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<N> Default for S<N>
where N: Default,

Source§

fn default() -> S<N>

Returns the “default value” for a type. Read more
Source§

impl<M, N> Lt<S<N>> for S<M>
where M: Nat + Lt<N>, N: Nat,

Source§

const VALUE: bool

true if Self < Rhs at the type level.
Source§

impl<N> Lt<S<N>> for Z
where N: Nat,

Source§

const VALUE: bool = true

true if Self < Rhs at the type level.
Source§

impl<M> Lt<Z> for S<M>
where M: Nat,

Source§

const VALUE: bool = false

true if Self < Rhs at the type level.
Source§

impl<M, N> Mul<N> for S<M>
where M: Nat + Mul<N>, N: Nat + Add<<M as Mul<N>>::Result>, <M as Mul<N>>::Result: Nat, <N as Add<<M as Mul<N>>::Result>>::Result: Nat,

Source§

type Result = <N as Add<<M as Mul<N>>::Result>>::Result

The resulting type-level natural.
Source§

impl<N> Nat for S<N>
where N: Nat,

Source§

fn to_u64() -> u64

The runtime u64 value of this type-level natural.
Source§

impl<N> Reflect for S<N>
where N: Nat,

Source§

type Value = RuntimeValue

The runtime representation of this type-level value.
Source§

fn reflect() -> <S<N> as Reflect>::Value

Produce the runtime value corresponding to this type-level value.
Source§

impl<N> Copy for S<N>
where N: Copy,

Auto Trait Implementations§

§

impl<N> Freeze for S<N>

§

impl<N> RefUnwindSafe for S<N>
where N: RefUnwindSafe,

§

impl<N> Send for S<N>
where N: Send,

§

impl<N> Sync for S<N>
where N: Sync,

§

impl<N> Unpin for S<N>
where N: Unpin,

§

impl<N> UnsafeUnpin for S<N>

§

impl<N> UnwindSafe for S<N>
where N: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.