Expand description

This project is a library for converting between different Ascii representations in the Rust language. This is made for Rust programs that need to convert an ascii value. This library has methods for converting any of the supported representations to another.


each supported ascii representation has it’s type listed below:

  • Binrary = Vec<u32>.

  • Decimals = Vec<u8>.

  • Characters = String.

  • Hexadecimals = Vec<String>.


Each method uses the Result enum for the return type so this will need to be unwrapped to get the actual value. An example of how best to deal with the Results enum is below:

use ascii_converter::*;
 
let input = vec![72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33];

match decimals_to_string(&input){
    Ok(num) => println!("* Output: {}", num),
    Err(e) => println!("* Error: {}", e),
};

Functions

This function takes in binary numbers and will return the decimal version.

This function changes the binary number passed into a hexadecimal value.

This function returns a string made from the binary values passed to it.

This function is passed decimal numbers and it then returns the hexadecimal representation.

This function returns a binary representations of decimal numbers

This function takes in Decimal numbers and will return the string they represent

This function takes in a hexadecimal number then returns the binary version.

This function takes a hexadecimal number and returns the decimal number.

This function returns a hexadecimal number’s string representation.

This function returns the binary numbers of each letter passed in.

This function returns a string’s decimal values

This function returns a hexadecimal that represents the string input.