Skip to main content

UnsignedExt

Trait UnsignedExt 

Source
pub trait UnsignedExt {
    type Type;

    // Required methods
    fn round_down_to_pow2(self) -> Self::Type;
    fn to_str_ranges(self) -> String;
    fn from_str_ranges(s: &str) -> Result<Self::Type, String>;
    fn bitidx_vec(self) -> Vec<usize>;
}

Required Associated Types§

Required Methods§

Source

fn round_down_to_pow2(self) -> Self::Type

Round down integer to its closes power-of-two.

Source

fn to_str_ranges(self) -> String

Convert integer to a string of bit blocks.

Source

fn from_str_ranges(s: &str) -> Result<Self::Type, String>

Return an integer from a bit flags string.

§Errors
Source

fn bitidx_vec(self) -> Vec<usize>

Generate a vector of all bit indexes containing a 1.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl UnsignedExt for u8

Source§

impl UnsignedExt for u16

Source§

impl UnsignedExt for u32

Source§

impl UnsignedExt for u64

Source§

impl UnsignedExt for usize

Implementors§