[][src]Struct to_binary::BinaryUsage

pub struct BinaryUsage;
👎 Deprecated

Binary Usage

The BinaryUsage Struct is used to perform functions or actions on Binary Strings, such as:

  • Adding/Removing Whitespace
  • Asserting Binary Strings
  • Asserting Binary Whitespace Strings
  • Asserting Bytes
  • Counting Bits
  • Counting Bytes

Implementations

impl BinaryUsage[src]

pub fn assert_binary(bin: String) -> bool[src]

Asserts The Input Is A Binary String, or a string with only:

  • 0
  • 1

This function is the same as assert_binary_string() just with a different name

pub fn assert_binary_string(bin: String) -> bool[src]

Asserts the Input Is A Binary String, or a String with only:

  • 0
  • 1
  • No Whitespace

pub fn assert_binary_whitespace(bin: String) -> bool[src]

Asserts The Input Is A Binary Whitespace String, or a String with only:

  • 0
  • 1
  • whitespace

TODO: Add a check for whitespace to be every 9nth character

pub fn assert_bytes(bin: String) -> bool[src]

Asserts The Input Has (8 * n) bits or contains full bytes using the remainder function

pub fn count_bits(bin: String) -> Result<usize, ()>[src]

Count number of bits for both a "Binary String" and "Binary Whitespace String" and returns a Result of either a usize or on error, empty response

pub fn count_bytes(bin: String) -> Result<usize, ()>[src]

Count number of bytes for both a "Binary String" and "Binary Whitespace String" and returns a Result of either a usize or on error, empty response

pub fn add_spaces(bin: String) -> Result<String, ()>[src]

pub fn remove_spaces(bin: String) -> String[src]

Removes All Whitespace From String And Returns String

Auto Trait Implementations

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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> 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.