pub struct ErrorResponse<'a> { /* private fields */ }
Expand description
The ErrorResponse
struct represents an error message sent from the server.
Available fields:
-
mtype
: Identifies the message as an error response. (value ='E'
) -
mlen
: Length of message contents in bytes, including self. -
severity
: Message severity. -
error_code
: Message code. -
message
: Error message. -
attributes
: Error attributes.
Implementations§
Source§impl<'a> ErrorResponse<'a>
impl<'a> ErrorResponse<'a>
Sourcepub const fn is_buffer(buf: &'a [u8]) -> bool
pub const fn is_buffer(buf: &'a [u8]) -> bool
Checks the constant values for this struct to determine whether this message matches.
Sourcepub fn new(buf: &'a [u8]) -> Result<Self, ParseError>
pub fn new(buf: &'a [u8]) -> Result<Self, ParseError>
Creates a new instance of this struct from a given buffer.
Sourcepub fn error_code(&self) -> u32
pub fn error_code(&self) -> u32
Message code.
Sourcepub fn attributes(&self) -> Array<'a, i16, KeyValue<'a>>
pub fn attributes(&self) -> Array<'a, i16, KeyValue<'a>>
Error attributes.
pub fn to_vec(self) -> Vec<u8> ⓘ
Trait Implementations§
Source§impl AsRef<[u8]> for ErrorResponse<'_>
impl AsRef<[u8]> for ErrorResponse<'_>
Source§impl<'a> Clone for ErrorResponse<'a>
impl<'a> Clone for ErrorResponse<'a>
Source§fn clone(&self) -> ErrorResponse<'a>
fn clone(&self) -> ErrorResponse<'a>
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'a> DataType for ErrorResponse<'a>
impl<'a> DataType for ErrorResponse<'a>
const META: StructFieldMeta
fn encode_usize(buf: &mut BufWriter<'_>, value: usize)
fn decode_usize(buf: &mut &[u8]) -> Result<usize, ParseError>
Source§impl Debug for ErrorResponse<'_>
impl Debug for ErrorResponse<'_>
Source§impl<'a> DecoderFor<'a, ErrorResponse<'a>> for ErrorResponse<'a>
impl<'a> DecoderFor<'a, ErrorResponse<'a>> for ErrorResponse<'a>
fn decode_for(buf: &mut &'a [u8]) -> Result<Self, ParseError>
Source§impl<'a> Default for ErrorResponse<'a>
impl<'a> Default for ErrorResponse<'a>
Source§fn default() -> ErrorResponse<'a>
fn default() -> ErrorResponse<'a>
Source§impl<SEVERITY, ERROR_CODE, MESSAGE, ATTRIBUTES> EncoderFor<ErrorResponse<'static>> for &ErrorResponseBuilder<SEVERITY, ERROR_CODE, MESSAGE, ATTRIBUTES>where
SEVERITY: EncoderFor<u8>,
ERROR_CODE: EncoderFor<u32>,
MESSAGE: EncoderFor<LString<'static>>,
ATTRIBUTES: EncoderFor<Array<'static, i16, KeyValue<'static>>>,
impl<SEVERITY, ERROR_CODE, MESSAGE, ATTRIBUTES> EncoderFor<ErrorResponse<'static>> for &ErrorResponseBuilder<SEVERITY, ERROR_CODE, MESSAGE, ATTRIBUTES>where
SEVERITY: EncoderFor<u8>,
ERROR_CODE: EncoderFor<u32>,
MESSAGE: EncoderFor<LString<'static>>,
ATTRIBUTES: EncoderFor<Array<'static, i16, KeyValue<'static>>>,
fn encode_for(&self, buf: &mut BufWriter<'_>)
Source§impl<'a> EncoderFor<ErrorResponse<'static>> for ErrorResponse<'a>
impl<'a> EncoderFor<ErrorResponse<'static>> for ErrorResponse<'a>
fn encode_for(&self, buf: &mut BufWriter<'_>)
Source§impl<SEVERITY, ERROR_CODE, MESSAGE, ATTRIBUTES> EncoderFor<ErrorResponse<'static>> for ErrorResponseBuilder<SEVERITY, ERROR_CODE, MESSAGE, ATTRIBUTES>where
SEVERITY: EncoderFor<u8>,
ERROR_CODE: EncoderFor<u32>,
MESSAGE: EncoderFor<LString<'static>>,
ATTRIBUTES: EncoderFor<Array<'static, i16, KeyValue<'static>>>,
impl<SEVERITY, ERROR_CODE, MESSAGE, ATTRIBUTES> EncoderFor<ErrorResponse<'static>> for ErrorResponseBuilder<SEVERITY, ERROR_CODE, MESSAGE, ATTRIBUTES>where
SEVERITY: EncoderFor<u8>,
ERROR_CODE: EncoderFor<u32>,
MESSAGE: EncoderFor<LString<'static>>,
ATTRIBUTES: EncoderFor<Array<'static, i16, KeyValue<'static>>>,
fn encode_for(&self, buf: &mut BufWriter<'_>)
Source§impl PartialEq for ErrorResponse<'_>
impl PartialEq for ErrorResponse<'_>
Source§impl<'a> StructMeta for ErrorResponse<'a>
Implements a trait containing the fields of the struct, allowing
us to compute some useful things.
impl<'a> StructMeta for ErrorResponse<'a>
Implements a trait containing the fields of the struct, allowing us to compute some useful things.
const FIELDS: StructFields
type Struct<'__struct> = ErrorResponse<'__struct>
fn new<'__next_lifetime>( buf: &'__next_lifetime [u8], ) -> Result<Self::Struct<'__next_lifetime>, ParseError>
fn to_vec(&self) -> Vec<u8> ⓘ
const FIELD_COUNT: usize = _
const IS_FIXED_SIZE: bool = _
const FIXED_SIZE: Option<usize> = _
const LENGTH_FIELD_INDEX: Option<usize> = _
const HAS_LENGTH_FIELD: bool = _
impl<'a> Copy for ErrorResponse<'a>
impl Eq for ErrorResponse<'_>
impl StructAttributeFieldCount<{<$name<'_> as $crate::prelude::StructMeta>::FIELD_COUNT}> for ErrorResponse<'_>
Implements a trait indicating that the struct has a field count.
impl StructAttributeFixedSize<{<$name<'_> as $crate::prelude::StructMeta>::IS_FIXED_SIZE}> for ErrorResponse<'_>
Implements a trait indicating that the struct has a fixed size. This needs to be a trait-generic rather than and associated constant for us to use elsewhere.
impl StructAttributeHasLengthField<{<$name<'_> as $crate::prelude::StructMeta>::HAS_LENGTH_FIELD}> for ErrorResponse<'_>
Implements a trait indicating that the struct has a length field.