pub struct Envelope {
pub version: Version,
pub direction: Direction,
pub flags: Flags,
pub opcode: Opcode,
pub stream_id: StreamId,
pub body: Vec<u8>,
pub tracing_id: Option<Uuid>,
pub warnings: Vec<String>,
}
Fields§
§version: Version
§direction: Direction
§flags: Flags
§opcode: Opcode
§stream_id: StreamId
§body: Vec<u8>
§tracing_id: Option<Uuid>
§warnings: Vec<String>
Implementations§
Source§impl Envelope
impl Envelope
Sourcepub fn new_req_auth_response(token_bytes: CBytes, version: Version) -> Envelope
pub fn new_req_auth_response(token_bytes: CBytes, version: Version) -> Envelope
Creates new envelope of type AuthResponse
.
Source§impl Envelope
impl Envelope
pub fn new_req_batch( query: BodyReqBatch, flags: Flags, version: Version, ) -> Envelope
Source§impl Envelope
impl Envelope
pub fn new_req_execute( id: &CBytesShort, result_metadata_id: Option<&CBytesShort>, query_parameters: &QueryParams, flags: Flags, version: Version, ) -> Envelope
Source§impl Envelope
impl Envelope
Sourcepub fn new_req_options(version: Version) -> Envelope
pub fn new_req_options(version: Version) -> Envelope
Creates new envelope of type options
.
Source§impl Envelope
impl Envelope
pub fn new_req_query( query: String, consistency: Consistency, values: Option<QueryValues>, with_names: bool, page_size: Option<CInt>, paging_state: Option<CBytes>, serial_consistency: Option<Consistency>, timestamp: Option<CLong>, keyspace: Option<String>, now_in_seconds: Option<CInt>, flags: Flags, version: Version, ) -> Envelope
pub fn new_query( query: BodyReqQuery, flags: Flags, version: Version, ) -> Envelope
Source§impl Envelope
impl Envelope
Sourcepub fn new_req_register(
events: Vec<SimpleServerEvent>,
version: Version,
) -> Envelope
pub fn new_req_register( events: Vec<SimpleServerEvent>, version: Version, ) -> Envelope
Creates new envelope of type REGISTER
.
Source§impl Envelope
impl Envelope
pub fn new( version: Version, direction: Direction, flags: Flags, opcode: Opcode, stream_id: StreamId, body: Vec<u8>, tracing_id: Option<Uuid>, warnings: Vec<String>, ) -> Self
pub fn request_body(&self) -> Result<RequestBody>
pub fn response_body(&self) -> Result<ResponseBody>
pub fn tracing_id(&self) -> &Option<Uuid>
pub fn warnings(&self) -> &[String]
Sourcepub fn from_buffer(
data: &[u8],
compression: Compression,
) -> Result<ParsedEnvelope, ParseEnvelopeError>
pub fn from_buffer( data: &[u8], compression: Compression, ) -> Result<ParsedEnvelope, ParseEnvelopeError>
Parses the raw bytes of a cassandra envelope returning a ParsedEnvelope
struct.
The typical use case is reading from a buffer that may contain 0 or more envelopes and where
the last envelope may be incomplete. The possible return values are:
Ok(ParsedEnvelope)
- The first envelope in the buffer has been successfully parsed.Err(ParseEnvelopeError::NotEnoughBytes)
- There are not enough bytes to parse a single envelope,Envelope::from_buffer
should be recalled when it is possible that there are more bytes.Err(_)
- The envelope is malformed and you should close the connection as this method does not provide a way to tell how many bytes to advance the buffer in this case.
pub fn check_envelope_size(data: &[u8]) -> Result<usize, CheckEnvelopeSizeError>
pub fn encode_with(&self, compressor: Compression) -> Result<Vec<u8>>
Trait Implementations§
impl Eq for Envelope
impl StructuralPartialEq for Envelope
Auto Trait Implementations§
impl Freeze for Envelope
impl RefUnwindSafe for Envelope
impl Send for Envelope
impl Sync for Envelope
impl Unpin for Envelope
impl UnwindSafe for Envelope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more