pub fn decode(
        &self,
        source_stream: &[u8],
        dest_stream: &mut [u8],
        read_len: &mut usize,
    ) -> Result<usize, DleError> {
        if self.escape_stx_etx {
            self.decode_escaped(source_stream, dest_stream, read_len)
        } else {
            self.decode_non_escaped(source_stream, dest_stream, read_len)
        }
    }
/// This method decodes a given byte stream which was encoded with a ASCII
/// DLE encoder. It explicitely does so in the escaped mode, which is the default
/// mode. It returns the length of the decoded buffer or an error code if
/// there is a decoder failure or the destination stream is too short.
///
/// # Arguments
///
/// * `source_stream` - The stream to decode
/// * `dest_stream` - Decoded stream will be written here
/// * `read_len` - The number of read bytes in the source stream will be
///   assigned to this variable
///
/// # Examples
///
/// ```
/// use dle_encoder::DleEncoder;
///
/// let dle_encoder = DleEncoder::default();
/// let mut decoding_buffer: [u8; 16] = [0; 16];
/// let encoded_array: [u8; 4] = [0x02, 0x10, 0x02 + 0x40, 0x03];
/// let mut read_len = 0;
/// let decode_result = dle_encoder.decode(
///     &encoded_array, &mut decoding_buffer, &mut read_len
/// );
/// assert!(decode_result.is_ok());
/// let decoded_len = decode_result.unwrap();
/// assert_eq!(decoded_len, 1);
///
/// println!("Source buffer: {:?}", encoded_array);
/// println!("Encoded stream: {:?}", &decoding_buffer[ .. decoded_len])
/// ```
This method decodes a given byte stream which was encoded with a ASCII
DLE encoder. It explicitely does so in the escaped mode, which is the default
mode. It returns the length of the decoded buffer or an error code if
there is a decoder failure or the destination stream is too short.
This method decodes a given byte stream which was encoded with a ASCII DLE encoder . It explicitely does so in the escaped mode which is the default mode . It returns the length of the decoded buffer or an error code if there is a decoder failure or the destination stream is too short .
pub fn decode(
        &self,
        source_stream: &[u8],
        dest_stream: &mut [u8],
        read_len: &mut usize,
    ) -> Result<usize, DleError> {
        if self.escape_stx_etx {
            self.decode_escaped(source_stream, dest_stream, read_len)
        } else {
            self.decode_non_escaped(source_stream, dest_stream, read_len)
        }
    }
pub fn decode ( & self , source_stream : & [ u8 ] , dest_stream : & mut [ u8 ] , read_len : & mut usize , ) -> Result < usize , DleError > { if self . escape_stx_etx { self . decode_escaped ( source_stream , dest_stream , read_len ) } else { self . decode_non_escaped ( source_stream , dest_stream , read_len ) } }
This method decodes a given byte stream which was encoded with a ASCII
DLE encoder.
This method decodes a given byte stream which was encoded with a ASCII DLE encoder .
&self
source_stream
&[u8]
dest_stream
&mut [u8]
read_len
&mut usize
&self
source_stream
&[u8]
dest_stream
&mut [u8]
read_len
&mut usize
examples
```
use dle_encoder::DleEncoder.

let dle_encoder = DleEncoder::default();
let mut decoding_buffer: [u8; 16] = [0; 16];
let encoded_array: [u8; 4] = [0x02, 0x10, 0x02 + 0x40, 0x03];
let mut read_len = 0;
let decode_result = dle_encoder.decode(
&encoded_array, &mut decoding_buffer, &mut read_len
);
assert!(decode_result.is_ok());
let decoded_len = decode_result.unwrap();
assert_eq!(decoded_len, 1).

println!("Source buffer: {:?}", encoded_array);
println!("Encoded stream: {:?}", &decoding_buffer[ ..
` ` ` use dle_encoder :: DleEncoder . let dle_encoder = DleEncoder :: default () ; let mut decoding_buffer : [ u8 ; 16 ] = [ 0 ; 16 ] ; let encoded_array : [ u8 ; 4 ] = [ 0x02 0x10 0x02 + 0x40 0x03 ] ; let mut read_len = 0 ; let decode_result = dle_encoder . decode ( &encoded_array &mut decoding_buffer &mut read_len ) ; assert! ( decode_result . is_ok () ) ; let decoded_len = decode_result . unwrap () ; assert_eq! ( decoded_len 1 ) . println! ( " Source buffer : { : ? } " encoded_array ) ; println! ( " Encoded stream : { : ? } " &decoding_buffer [ ..