fn read_options(buf: &[u8]) -> Result<HashMap<String, String>> {
    let mut reader = Reader::new(&buf);
    let mut options = HashMap::new();

    // Use a `Reader` and loop until EOF is reached, so that we can
    // read all options from the provided byte slice.
    loop {
        let name = match reader.read_string() {
            Ok(v) => v,
            Err(e) => match e {
                Error::UnexpectedEof => break,
                _ => return Err(e),
            },
        };

        // If we have a `string` option extract the value from the buffer,
        // otherwise we have a `flag` option which is the `empty` string.
        let value_buf = reader.read_bytes()?;
        let value = if !value_buf.is_empty() {
            Reader::new(&value_buf).read_string()?
        } else {
            "".to_string()
        };

        options.insert(name, value);
    }

    Ok(options)
}
// Reads `option` values from a byte sequence.
// The `option` values are used to represent the `critical options` and
// `extensions` in an OpenSSH certificate key, which are represented as tuples
// containing the `name` and `data` values of type `string`.
// Some `options` are `flags` only (e.g. the certificate extensions) and the
// associated value with them is the empty string (""), while others are `string`
// options and have an associated value, which is a `string`.
// The `critical options` of a certificate are always `string` options, since they
// have an associated `string` value, which is embedded in a separate buffer, so
// in order to extract the associated value we need to read the buffer first and then
// read the `string` value itself.
Reads `option` values from a byte sequence.
Reads ` option ` values from a byte sequence .
fn read_options(buf: &[u8]) -> Result<HashMap<String, String>> {
    let mut reader = Reader::new(&buf);
    let mut options = HashMap::new();
    // Use a `Reader` and loop until EOF is reached, so that we can
    // read all options from the provided byte slice.
    loop {
        let name = match reader.read_string() {
            Ok(v) => v,
            Err(e) => match e {
                Error::UnexpectedEof => break,
                _ => return Err(e),
            },
        };
        // If we have a `string` option extract the value from the buffer,
        // otherwise we have a `flag` option which is the `empty` string.
        let value_buf = reader.read_bytes()?;
        let value = if !value_buf.is_empty() {
            Reader::new(&value_buf).read_string()?
        } else {
            "".to_string()
        };
        options.insert(name, value);
    }
    Ok(options)
}
fn read_options ( buf : & [ u8 ] ) -> Result < HashMap < String , String > > { let mut reader = Reader :: new ( & buf ) ; let mut options = HashMap :: new ( ) ; // Use a `Reader` and loop until EOF is reached, so that we can // read all options from the provided byte slice. loop { let name = match reader . read_string ( ) { Ok ( v ) => v , Err ( e ) => match e { Error :: UnexpectedEof => break , _ => return Err ( e ) , } , } ; // If we have a `string` option extract the value from the buffer, // otherwise we have a `flag` option which is the `empty` string. let value_buf = reader . read_bytes ( ) ? ; let value = if ! value_buf . is_empty ( ) { Reader :: new ( & value_buf ) . read_string ( ) ? } else { " " . to_string ( ) } ; options . insert ( name , value ) ; } Ok ( options ) }
Reads `option` values from a byte sequence.
Reads ` option ` values from a byte sequence .
buf
&[u8]