Trait Serial

Source
pub trait Serial: PartialEq {
    const START: Self;

    // Required methods
    fn next_increment(&self) -> Self;
    fn prev_increment(&self) -> Self;
    fn is_max_value(&self) -> bool;
}
Expand description

Defines how a type is used by SerialGenerator.

Required Associated Constants§

Source

const START: Self

The default initial and lowest possible value.

Required Methods§

Source

fn next_increment(&self) -> Self

Returns the next sequential value. Returns an equal value if it is at its maximum.

Source

fn prev_increment(&self) -> Self

Returns the previous sequential value. Returns an equal value if it is at its minimum.

Source

fn is_max_value(&self) -> bool

Returns a boolean representing whether the value is equal to its maximum.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Serial for u8

Source§

const START: Self = 0u8

Source§

fn next_increment(&self) -> Self

Source§

fn prev_increment(&self) -> Self

Source§

fn is_max_value(&self) -> bool

Source§

impl Serial for u16

Source§

const START: Self = 0u16

Source§

fn next_increment(&self) -> Self

Source§

fn prev_increment(&self) -> Self

Source§

fn is_max_value(&self) -> bool

Source§

impl Serial for u32

Source§

const START: Self = 0u32

Source§

fn next_increment(&self) -> Self

Source§

fn prev_increment(&self) -> Self

Source§

fn is_max_value(&self) -> bool

Source§

impl Serial for u64

Source§

const START: Self = 0u64

Source§

fn next_increment(&self) -> Self

Source§

fn prev_increment(&self) -> Self

Source§

fn is_max_value(&self) -> bool

Source§

impl Serial for u128

Source§

const START: Self = 0u128

Source§

fn next_increment(&self) -> Self

Source§

fn prev_increment(&self) -> Self

Source§

fn is_max_value(&self) -> bool

Source§

impl Serial for usize

Source§

const START: Self = 0usize

Source§

fn next_increment(&self) -> Self

Source§

fn prev_increment(&self) -> Self

Source§

fn is_max_value(&self) -> bool

Implementors§