pub fn encode(&self, source_stream: &[u8], dest_stream: &mut [u8]) -> Result<usize, DleError> {
        if self.escape_stx_etx {
            self.encode_escaped(source_stream, dest_stream)
        } else {
            self.encode_non_escaped(source_stream, dest_stream)
        }
    }
/// This method encodes a given byte stream with ASCII based DLE encoding.
/// It returns the number of encoded bytes or a DLE error code.
///
/// # Arguments
///
/// * `source_stream` - The stream to encode
/// * `dest_stream` - Encoded stream will be written here
///
/// # Examples
///
/// ```
/// use dle_encoder::DleEncoder;
///
/// let dle_encoder = DleEncoder::default();
/// let mut encoding_buffer: [u8; 16] = [0; 16];
/// let example_array: [u8; 3] = [0, 0x02, 0x10];
///
/// let encode_result = dle_encoder.encode(
///     &example_array, &mut encoding_buffer
/// );
/// assert!(encode_result.is_ok());
/// let encoded_len = encode_result.unwrap();
/// assert_eq!(encoded_len, 7);
///
/// println!("Source buffer: {:?}", example_array);
/// println!("Encoded stream: {:?}", &encoding_buffer[ .. encoded_len])
/// ```
This method encodes a given byte stream with ASCII based DLE encoding.
It returns the number of encoded bytes or a DLE error code.
This method encodes a given byte stream with ASCII based DLE encoding . It returns the number of encoded bytes or a DLE error code .
pub fn encode(&self, source_stream: &[u8], dest_stream: &mut [u8]) -> Result<usize, DleError> {
        if self.escape_stx_etx {
            self.encode_escaped(source_stream, dest_stream)
        } else {
            self.encode_non_escaped(source_stream, dest_stream)
        }
    }
pub fn encode ( & self , source_stream : & [ u8 ] , dest_stream : & mut [ u8 ] ) -> Result < usize , DleError > { if self . escape_stx_etx { self . encode_escaped ( source_stream , dest_stream ) } else { self . encode_non_escaped ( source_stream , dest_stream ) } }
This method encodes a given byte stream with ASCII based DLE encoding.
This method encodes a given byte stream with ASCII based DLE encoding .
&self
source_stream
&[u8]
dest_stream
&mut [u8]
&self
source_stream
&[u8]
dest_stream
&mut [u8]
examples
```
use dle_encoder::DleEncoder.



let encode_result = dle_encoder.encode(
&example_array, &mut encoding_buffer
);
assert!(encode_result.is_ok());
let encoded_len = encode_result.unwrap();
assert_eq!(encoded_len, 7).

println!("Source buffer: {:?}", example_array);
println!("Encoded stream: {:?}", &encoding_buffer[ ..
` ` ` use dle_encoder :: DleEncoder . let encode_result = dle_encoder . encode ( &example_array &mut encoding_buffer ) ; assert! ( encode_result . is_ok () ) ; let encoded_len = encode_result . unwrap () ; assert_eq! ( encoded_len 7 ) . println! ( " Source buffer : { : ? } " example_array ) ; println! ( " Encoded stream : { : ? } " &encoding_buffer [ ..