pub fn encode(data: &[u8]) -> String {
    data.iter()
        .copied()
        .fold(String::with_capacity(data.len() * 8), |buffer, byte| {
            (0..8).rev().fold(buffer, |mut buffer, bit| {
                buffer.push(match byte & (1u8 << bit) {
                    0 => LOW,
                    _ => HIGH,
                });

                buffer
            })
        })
}
/// Encodes the given binary data as whitespace.
///
/// Each byte is with one character for each bit.
///  - \u{0020} (whitespace) represents a high bit
///  - \u{200b} (zero width whitespace) represents a low bit
///
/// ## Examples
///
/// ```rust
/// use whitespace::encode;
///
/// let data = vec![10, 10];
/// let encoded = encode(&data);
///
/// assert_eq!(
///     "\u{200b}\u{200b}\u{200b}\u{200b}\u{0020}\u{200b}\u{0020}\u{200b}\u{200b}\u{200b}\u{200b}\u{200b}\u{0020}\u{200b}\u{0020}\u{200b}",
///     encoded
/// );
/// ```
Encodes the given binary data as whitespace.
Each byte is with one character for each bit.
\u{0020} (whitespace) represents a high bit
\u{200b} (zero width whitespace) represents a low bit
Encodes the given binary data as whitespace . Each byte is with one character for each bit . \ u { 0020 } ( whitespace ) represents a high bit \ u { 200b } ( zero width whitespace ) represents a low bit
pub fn encode(data: &[u8]) -> String {
    data.iter()
        .copied()
        .fold(String::with_capacity(data.len() * 8), |buffer, byte| {
            (0..8).rev().fold(buffer, |mut buffer, bit| {
                buffer.push(match byte & (1u8 << bit) {
                    0 => LOW,
                    _ => HIGH,
                });
                buffer
            })
        })
}
pub fn encode ( data : & [ u8 ] ) -> String { data . iter ( ) . copied ( ) . fold ( String :: with_capacity ( data . len ( ) * 8 ) , | buffer , byte | { ( 0 .. 8 ) . rev ( ) . fold ( buffer , | mut buffer , bit | { buffer . push ( match byte & ( 1u8 << bit ) { 0 => LOW , _ => HIGH , } ) ; buffer } ) } ) }
Encodes the given binary data as whitespace.
Encodes the given binary data as whitespace .
data
&[u8]
data
&[u8]
examples
```rust
use whitespace::encode.

let data = vec![10, 10];
let encoded = encode(&data).


` ` ` rust use whitespace :: encode . let data = vec! [ 10 10 ] ; let encoded = encode ( &data ) .