use byteorder::ReadBytesExt;
use crate::codec::*;
use crate::IoResult;
#[derive(Debug, Default, Clone)]
pub struct ApiVersionsRequest {
pub client_software_name: String,
pub client_software_version: String,
pub unknown_tagged_fields: Vec<RawTaggedField>,
}
impl Decodable for ApiVersionsRequest {
fn read<B: ReadBytesExt>(buf: &mut B, version: i16) -> IoResult<Self> {
let mut this = ApiVersionsRequest::default();
if version >= 3 {
this.client_software_name = NullableString(true)
.decode(buf)?
.ok_or_else(|| err_decode_message_null("client_software_name"))?;
}
if version >= 3 {
this.client_software_version = NullableString(true)
.decode(buf)?
.ok_or_else(|| err_decode_message_null("client_software_version"))?;
}
if version >= 3 {
this.unknown_tagged_fields = RawTaggedFieldList.decode(buf)?;
}
Ok(this)
}
}