Struct cassandra_protocol::frame::Frame
source · [−]pub struct Frame {
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 Frame
impl Frame
sourcepub fn new_req_auth_response(token_bytes: CBytes, version: Version) -> Frame
pub fn new_req_auth_response(token_bytes: CBytes, version: Version) -> Frame
Creates new frame of type AuthResponse
.
sourceimpl Frame
impl Frame
pub fn new_req_batch(
query: BodyReqBatch,
flags: Flags,
version: Version
) -> Frame
sourceimpl Frame
impl Frame
pub fn new_req_execute(
id: &CBytesShort,
query_parameters: &QueryParams,
flags: Flags,
version: Version
) -> Frame
sourceimpl Frame
impl Frame
sourcepub fn new_req_options(version: Version) -> Frame
pub fn new_req_options(version: Version) -> Frame
Creates new frame of type options
.
sourceimpl Frame
impl Frame
pub fn new_req_query(
query: String,
consistency: Consistency,
values: Option<QueryValues>,
with_names: bool,
page_size: Option<i32>,
paging_state: Option<CBytes>,
serial_consistency: Option<Consistency>,
timestamp: Option<i64>,
flags: Flags,
version: Version
) -> Frame
pub fn new_query(query: Query, flags: Flags, version: Version) -> Frame
sourceimpl Frame
impl Frame
sourcepub fn new_req_register(
events: Vec<SimpleServerEvent>,
version: Version
) -> Frame
pub fn new_req_register(
events: Vec<SimpleServerEvent>,
version: Version
) -> Frame
Creates new frame of type REGISTER
.
sourceimpl Frame
impl Frame
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],
compressor: Compression
) -> Result<ParsedFrame, ParseFrameError>
pub fn from_buffer(
data: &[u8],
compressor: Compression
) -> Result<ParsedFrame, ParseFrameError>
Parses the raw bytes of a cassandra frame returning a Frame
struct.
The typical use case is reading from a buffer that may contain 0 or more frames and where the last frame may be incomplete.
The possible return values are:
Ok(ParsedFrame)
- The first frame in the buffer has been successfully parsed.Err(ParseFrameError::NotEnoughBytes)
- There are not enough bytes to parse a single frame,Frame::from_buffer
should be recalled when it is possible that there are more bytes.Err(_)
- The frame 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 encode_with(&self, compressor: Compression) -> Result<Vec<u8>>
Trait Implementations
sourceimpl Ord for Frame
impl Ord for Frame
sourceimpl PartialOrd<Frame> for Frame
impl PartialOrd<Frame> for Frame
sourcefn partial_cmp(&self, other: &Frame) -> Option<Ordering>
fn partial_cmp(&self, other: &Frame) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
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 more
impl Eq for Frame
impl StructuralEq for Frame
impl StructuralPartialEq for Frame
Auto Trait Implementations
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnwindSafe for Frame
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more