[][src]Struct numid::example::NumId

pub struct NumId(_);

A numerical id generated with the numid! macro. This struct example is generated with the macro call : numid!(pub struct NumId);.

Methods

impl NumId[src]

pub const INITIAL_VALUE: u64[src]

Constant defined when calling the numid! macro (0 if not defined). The firt id created (with new() or default()) will have value = INITIAL_VALUE + 1.

pub fn new() -> NumId[src]

Increment the current value and create a new id with value = current_value().

pub const fn value(self) -> u64[src]

Get the value of the id.

pub fn current_value() -> u64[src]

Return the value of the last id created (with new() or default()), if no id has been created, return initial_value().

pub const fn initial_value() -> u64[src]

Return INITIAL_VALUE.

pub fn replace_current_value(value: u64) -> bool[src]

Replace the current value by the value parameter if it superior. This condition is necessary for not creating multiple ids with the same value. Return true if the current value has been modified.

pub fn create_lower(value: u64) -> NumId[src]

Create a id with a precised value, don't increment the current value. The value must be inferior or equal as INITIAL_VALUE for not interfering with the id system.

Panics

panic if value > INITIAL_VALUE

Trait Implementations

impl Display for NumId[src]

impl Debug for NumId[src]

impl PartialEq<NumId> for NumId[src]

impl Eq for NumId[src]

impl Ord for NumId[src]

impl PartialOrd<NumId> for NumId[src]

impl Hash for NumId[src]

impl Copy for NumId[src]

impl Clone for NumId[src]

impl Default for NumId[src]

Auto Trait Implementations

impl Unpin for NumId

impl Send for NumId

impl Sync for NumId

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]