Struct NumAppender

Source
pub struct NumAppender<T, const N: u32>(pub Option<T>);
Expand description

An integer appender.

When T implements Default, AddAssign<T> and MulAssign<usize> then NumAppender<T, N> implements Appender<T> in the following way: if self contains t of type T then pushing s in self updates t into (t * N) + s.

This struct is useful when you want to parse an integer from a text file.

Tuple Fields§

§0: Option<T>

Implementations§

Source§

impl<T, const N: u32> NumAppender<T, N>

Source

pub const fn is_empty(&self) -> bool

Tests if it is empty.

Returns true if and only if no value has been pushed.

Trait Implementations§

Source§

impl<T, const N: u32> Appender<T> for NumAppender<T, N>
where T: AddAssign<T> + MulAssign<u32>,

Source§

fn new_empty() -> Self

Creates a new empty container.
Source§

fn push(&mut self, i: T)

Push a new object in the container.

Auto Trait Implementations§

§

impl<T, const N: u32> Freeze for NumAppender<T, N>
where T: Freeze,

§

impl<T, const N: u32> RefUnwindSafe for NumAppender<T, N>
where T: RefUnwindSafe,

§

impl<T, const N: u32> Send for NumAppender<T, N>
where T: Send,

§

impl<T, const N: u32> Sync for NumAppender<T, N>
where T: Sync,

§

impl<T, const N: u32> Unpin for NumAppender<T, N>
where T: Unpin,

§

impl<T, const N: u32> UnwindSafe for NumAppender<T, N>
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> 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, 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.