Trait Encoding

Source
pub trait Encoding {
    // Required methods
    fn extend_ssh_string(&mut self, s: &[u8]);
    fn extend_ssh_string_blank(&mut self, s: usize) -> &mut [u8] ;
    fn extend_ssh_mpint(&mut self, s: &[u8]);
    fn extend_list<'a, I: Iterator<Item = &'a [u8]>>(&mut self, list: I);
    fn extend_u32(&mut self, u: u32);
    fn write_empty_list(&mut self);
    fn write_len(&mut self);

    // Provided method
    fn extend_usize(&mut self, u: usize) { ... }
}
Expand description

Encode in the SSH format.

Required Methods§

Source

fn extend_ssh_string(&mut self, s: &[u8])

Push an SSH-encoded string to self.

Source

fn extend_ssh_string_blank(&mut self, s: usize) -> &mut [u8]

Push an SSH-encoded blank string of length s to self.

Source

fn extend_ssh_mpint(&mut self, s: &[u8])

Push an SSH-encoded multiple-precision integer.

Source

fn extend_list<'a, I: Iterator<Item = &'a [u8]>>(&mut self, list: I)

Push an SSH-encoded list.

Source

fn extend_u32(&mut self, u: u32)

Push an SSH-encoded unsigned 32-bit integer.

Source

fn write_empty_list(&mut self)

Push an SSH-encoded empty list.

Source

fn write_len(&mut self)

Write the buffer length at the beginning of the buffer.

Provided Methods§

Source

fn extend_usize(&mut self, u: usize)

Push a usize as an SSH-encoded unsiged 32-bit integer. May panic if the argument is greater than u32::MAX. This is a convience method, to spare callers casting or converting usize to u32. If callers end up in a situation where they need to push a 32-bit unisgned integer, but the value they would like to push does not fit 32 bits, then the implementation will not comply with the SSH format anyway.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Encoding for Vec<u8>

Source§

fn extend_ssh_string(&mut self, s: &[u8])

Source§

fn extend_ssh_string_blank(&mut self, len: usize) -> &mut [u8]

Source§

fn extend_ssh_mpint(&mut self, s: &[u8])

Source§

fn extend_u32(&mut self, s: u32)

Source§

fn extend_list<'a, I: Iterator<Item = &'a [u8]>>(&mut self, list: I)

Source§

fn write_empty_list(&mut self)

Source§

fn write_len(&mut self)

Implementors§