[−][src]Struct numid::example::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]
fn cmp(&self, other: &NumId) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialOrd<NumId> for NumId
[src]
fn partial_cmp(&self, other: &NumId) -> Option<Ordering>
[src]
fn lt(&self, other: &NumId) -> bool
[src]
fn le(&self, other: &NumId) -> bool
[src]
fn gt(&self, other: &NumId) -> bool
[src]
fn ge(&self, other: &NumId) -> bool
[src]
impl Hash for NumId
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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
impl UnwindSafe for NumId
impl RefUnwindSafe for NumId
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,