scylla_cql/frame/request/
auth_response.rs1use std::num::TryFromIntError;
2
3use thiserror::Error;
4
5use crate::frame::frame_errors::CqlRequestSerializationError;
6
7use crate::frame::request::{RequestOpcode, SerializableRequest};
8use crate::frame::types::write_bytes_opt;
9
10pub struct AuthResponse {
12 pub response: Option<Vec<u8>>,
13}
14
15impl SerializableRequest for AuthResponse {
16 const OPCODE: RequestOpcode = RequestOpcode::AuthResponse;
17
18 fn serialize(&self, buf: &mut Vec<u8>) -> Result<(), CqlRequestSerializationError> {
19 Ok(write_bytes_opt(self.response.as_ref(), buf)
20 .map_err(AuthResponseSerializationError::ResponseSerialization)?)
21 }
22}
23
24#[non_exhaustive]
26#[derive(Error, Debug, Clone)]
27pub enum AuthResponseSerializationError {
28 #[error("AUTH_RESPONSE body bytes length too big: {0}")]
30 ResponseSerialization(TryFromIntError),
31}