Trait BitPatternExt

Source
pub trait BitPatternExt
where Self: Sized,
{ // Required methods fn from_value<T>(val: T) -> Self where T: BitStore; fn from_str(s: &str) -> Result<Self, Error>; fn from_bin_str(s: &str) -> Self; fn from_dec_str(s: &str) -> Self; fn from_oct_str(s: &str) -> Self; fn from_hex_str(s: &str) -> Self; fn is_all_one(&self) -> bool; fn is_all_zero(&self) -> bool; fn to_bin_string(&self) -> String; fn to_oct_string(&self) -> String; fn to_dec_string(&self) -> String; fn to_hex_string(&self) -> String; }

Required Methods§

Source

fn from_value<T>(val: T) -> Self
where T: BitStore,

Source

fn from_str(s: &str) -> Result<Self, Error>

Create from the given string. The radix is deduced from the first 2 chars. ‘0b’ => binary, ‘0x’ => hexadecimal, ‘0o’ => octal, ‘0d’ => decimal.

Source

fn from_bin_str(s: &str) -> Self

Create from the given binary string. Any character other than ‘0’ or ‘1’ is ignored.

Source

fn from_dec_str(s: &str) -> Self

Create from the given decimal string. Any character other than decimal digits is ignored.

Source

fn from_oct_str(s: &str) -> Self

Create from the given octal string. Any character other than octal digits is ignored.

Source

fn from_hex_str(s: &str) -> Self

Create from the given hexadecimal string. Any character other than hexadecimal digits is ignored.

Source

fn is_all_one(&self) -> bool

Check if the bit pattern is all one.

Source

fn is_all_zero(&self) -> bool

Check if the bit pattern is all zero.

Source

fn to_bin_string(&self) -> String

Convert the bit pattern to a string representing the binary value.

Source

fn to_oct_string(&self) -> String

Convert the bit pattern to a string representing the decimal value.

Source

fn to_dec_string(&self) -> String

Convert the bit pattern to a string representing the hexadecimal value.

Source

fn to_hex_string(&self) -> String

Convert the bit pattern to a string representing the hexadecimal value.

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.

Implementors§