Struct bijection::Bijection
[−]
[src]
pub struct Bijection { /* fields omitted */ }
Methods
impl Bijection
[src]
impl Bijection
[src]
fn convert_string(&mut self, input: &str) -> Result<Vec<u8>, Error>
fn convert_u8(&mut self, input: u8) -> Result<Vec<u8>, Error>
Converts an unsigned 8-bit integer.
Example
let result = Bijection::new("example").convert_u8(u8::max_value());
fn convert_u16(&mut self, input: u16) -> Result<Vec<u8>, Error>
Converts an unsigned 16-bit integer.
Example
let result = Bijection::new("example").convert_u16(u16::max_value());
fn convert_u32(&mut self, input: u32) -> Result<Vec<u8>, Error>
Converts an unsigned 32-bit integer.
Example
let result = Bijection::new("example").convert_u32(u32::max_value());
fn convert_u64(&mut self, input: u64) -> Result<Vec<u8>, Error>
Converts an unsigned 64-bit integer.
Example
let result = Bijection::new("example").convert_u64(u64::max_value());
impl Bijection
[src]
fn revert_string(&mut self, input: &[u8]) -> Result<String, Error>
Reverts a string.
Example
let mut bijection = Bijection::new("example"); let converted_value = bijection.convert_string("Example string").unwrap(); let result = bijection.revert_string(&converted_value);
fn revert_u8(&mut self, input: &[u8; 1]) -> Result<u8, Error>
Reverts an unsigned 8-bit integer.
Example
let mut bijection = Bijection::new("example"); let converted_value = bijection.convert_u8(u8::max_value()).unwrap(); let result = Bijection::new("example").revert_u8(array_ref!(converted_value, 0, 1));
fn revert_u16(&mut self, input: &[u8; 2]) -> Result<u16, Error>
Reverts an unsigned 16-bit integer.
Example
let mut bijection = Bijection::new("example"); let converted_value = bijection.convert_u16(u16::max_value()).unwrap(); let result = Bijection::new("example").revert_u16(array_ref!(converted_value, 0, 2));
fn revert_u32(&mut self, input: &[u8; 4]) -> Result<u32, Error>
Reverts an unsigned 8-bit integer.
Example
let mut bijection = Bijection::new("example"); let converted_value = bijection.convert_u32(u32::max_value()).unwrap(); let result = Bijection::new("example").revert_u32(array_ref!(converted_value, 0, 4));
fn revert_u64(&mut self, input: &[u8; 8]) -> Result<u64, Error>
Reverts an unsigned 8-bit integer.
Example
let mut bijection = Bijection::new("example"); let converted_value = bijection.convert_u64(u64::max_value()).unwrap(); let result = Bijection::new("example").revert_u64(array_ref!(converted_value, 0, 8));
impl Bijection
[src]
fn convert_bytes(&mut self, input: &[u8]) -> Result<Vec<u8>, Error>
Converts a byte array.
Example
let result = Bijection::new("example").convert_bytes("Example string".as_bytes());
fn revert_bytes(&mut self, input: &[u8]) -> Result<Vec<u8>, Error>
Reverts a byte array.
Example
let mut bijection = Bijection::new("example"); let converted_value = bijection.convert_bytes("Example string".as_bytes()).unwrap(); let result = bijection.revert_bytes(&converted_value);