Struct Single

Source
pub struct Single<T>(pub T);
Expand description

Type constructor to wrap a another type into a tuple.

§Sample :: struct instead of macro.

Sometimes it’s sufficient to use common type instead of defining a brand new one. You may use paramtetrized struct fundamental_data_type::Single< T > instead of macro fundamental_data_type::types! if that is the case.

use type_constructor::prelude::*;
let x = Single::< i32 >( 13 );
dbg!( x );

Tuple Fields§

§0: T

Trait Implementations§

Source§

impl<T> AsArray<T, 1> for Single<T>

Source§

fn as_array(&self) -> &[T; 1]

Reinterpret as array.
Source§

impl<T> AsSlice<T> for Single<T>

Source§

fn as_slice(&self) -> &[T]

Reinterpret as slice.
Source§

impl<T> AsTuple<(T,)> for Single<T>

Source§

fn as_tuple(&self) -> &(T,)

Reinterpret as tuple.
Source§

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

Source§

fn clone(&self) -> Single<T>

Returns a copy 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<T> CloneAsArray<T, 1> for Single<T>
where T: Clone,

Source§

fn clone_as_array(&self) -> [T; 1]

Clone as array.
Source§

impl<T> CloneAsTuple<(T,)> for Single<T>
where T: Clone,

Source§

fn clone_as_tuple(&self) -> (T,)

Clone as tuple.
Source§

impl<T> Debug for Single<T>
where T: Debug,

Source§

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

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

impl<T> Default for Single<T>
where T: Default,

Source§

fn default() -> Single<T>

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

impl<T> Deref for Single<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<Single<T> as Deref>::Target

Dereferences the value.
Source§

impl<T> DerefMut for Single<T>

Source§

fn deref_mut(&mut self) -> &mut <Single<T> as Deref>::Target

Mutably dereferences the value.
Source§

impl<T> From<&[T]> for Single<T>
where T: Clone,

Source§

fn from(src: &[T]) -> Single<T>

Converts to this type from the input type.
Source§

impl<T> From<&T> for Single<T>
where T: Clone,

Source§

fn from(src: &T) -> Single<T>

Converts to this type from the input type.
Source§

impl<T> From<[T; 1]> for Single<T>
where T: Clone,

Source§

fn from(src: [T; 1]) -> Single<T>

Converts to this type from the input type.
Source§

impl<T> From<(T,)> for Single<T>

Source§

fn from(src: (T,)) -> Single<T>

Converts to this type from the input type.
Source§

impl<T> From<Single<T>> for (T,)

Source§

fn from(src: Single<T>) -> (T,)

Converts to this type from the input type.
Source§

impl<T> From<T> for Single<T>

Source§

fn from(src: T) -> Single<T>

Converts to this type from the input type.
Source§

impl<T> Make0 for Single<T>
where T: Default,

Source§

fn make_0() -> Single<T>

Constructor without arguments.
Source§

fn make() -> Self

Constructor without arguments.
Source§

impl<T> Make1<T> for Single<T>

Source§

fn make_1(_0: T) -> Single<T>

Constructor without arguments.
Source§

fn make(arg: Arg) -> Self

Constructor without arguments.
Source§

impl<T> PartialEq for Single<T>
where T: PartialEq,

Source§

fn eq(&self, other: &Single<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Eq for Single<T>
where T: Eq,

Source§

impl<T> StructuralPartialEq for Single<T>

Auto Trait Implementations§

§

impl<T> Freeze for Single<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Single<T>
where T: RefUnwindSafe,

§

impl<T> Send for Single<T>
where T: Send,

§

impl<T> Sync for Single<T>
where T: Sync,

§

impl<T> Unpin for Single<T>
where T: Unpin,

§

impl<T> UnwindSafe for Single<T>
where T: 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.
Source§

impl<Target, Original> VectorizedInto<Target> for Original
where Target: VectorizedFrom<Original>,

Source§

fn vectorized_into(self) -> Target

Performs the conversion.