scylla_cql/frame/response/
supported.rs

1//! CQL protocol-level representation of a `SUPPORTED` response.
2
3use crate::frame::frame_errors::CqlSupportedParseError;
4use crate::frame::types;
5use std::collections::HashMap;
6
7#[derive(Debug)]
8/// The CQL protocol-level representation of an `SUPPORTED` response,
9/// used to present the server's supported options.
10pub struct Supported {
11    /// A map of option names to their supported values.
12    pub options: HashMap<String, Vec<String>>,
13}
14
15impl Supported {
16    /// Deserializes a `SUPPORTED` response from the provided byte buffer.
17    pub fn deserialize(buf: &mut &[u8]) -> Result<Self, CqlSupportedParseError> {
18        let options = types::read_string_multimap(buf)
19            .map_err(CqlSupportedParseError::OptionsMapDeserialization)?;
20
21        Ok(Supported { options })
22    }
23}