Struct cassandra_protocol::frame::Envelope
source · [−]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
sourceimpl 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
.
sourceimpl Envelope
impl Envelope
pub fn new_req_batch(
query: BodyReqBatch,
flags: Flags,
version: Version
) -> Envelope
sourceimpl Envelope
impl Envelope
pub fn new_req_execute(
id: &CBytesShort,
result_metadata_id: Option<&CBytesShort>,
query_parameters: &QueryParams,
flags: Flags,
version: Version
) -> Envelope
sourceimpl 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
.
sourceimpl 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: Query, flags: Flags, version: Version) -> Envelope
sourceimpl 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
.
sourceimpl 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
sourceimpl Ord for Envelope
impl Ord for Envelope
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<Envelope> for Envelope
impl PartialOrd<Envelope> for Envelope
sourcefn partial_cmp(&self, other: &Envelope) -> Option<Ordering>
fn partial_cmp(&self, other: &Envelope) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Envelope
impl StructuralEq for Envelope
impl StructuralPartialEq for Envelope
Auto Trait Implementations
impl RefUnwindSafe for Envelope
impl Send for Envelope
impl Sync for Envelope
impl Unpin for Envelope
impl UnwindSafe for Envelope
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more