Full Code of krojew/cdrs-tokio for AI

master 27d38d2ad9bb cached
155 files
988.6 KB
244.5k tokens
1581 symbols
1 requests
Download .txt
Showing preview only (1,042K chars total). Download the full file or copy to clipboard to get everything.
Repository: krojew/cdrs-tokio
Branch: master
Commit: 27d38d2ad9bb
Files: 155
Total size: 988.6 KB

Directory structure:
gitextract_xk4fwcia/

├── .github/
│   ├── FUNDING.yml
│   ├── dependabot.yml
│   ├── stale.yml
│   └── workflows/
│       └── rust.yml
├── .gitignore
├── Cargo.toml
├── LICENSE-APACHE
├── LICENSE-MIT
├── README.md
├── cassandra-ports.txt
├── cassandra-protocol/
│   ├── Cargo.toml
│   ├── README.md
│   └── src/
│       ├── authenticators.rs
│       ├── compression.rs
│       ├── consistency.rs
│       ├── crc.rs
│       ├── error.rs
│       ├── events.rs
│       ├── frame/
│       │   ├── events.rs
│       │   ├── frame_decoder.rs
│       │   ├── frame_encoder.rs
│       │   ├── message_auth_challenge.rs
│       │   ├── message_auth_response.rs
│       │   ├── message_auth_success.rs
│       │   ├── message_authenticate.rs
│       │   ├── message_batch.rs
│       │   ├── message_error.rs
│       │   ├── message_event.rs
│       │   ├── message_execute.rs
│       │   ├── message_options.rs
│       │   ├── message_prepare.rs
│       │   ├── message_query.rs
│       │   ├── message_ready.rs
│       │   ├── message_register.rs
│       │   ├── message_request.rs
│       │   ├── message_response.rs
│       │   ├── message_result.rs
│       │   ├── message_startup.rs
│       │   ├── message_supported.rs
│       │   └── traits.rs
│       ├── frame.rs
│       ├── lib.rs
│       ├── macros.rs
│       ├── query/
│       │   ├── batch_query_builder.rs
│       │   ├── prepare_flags.rs
│       │   ├── prepared_query.rs
│       │   ├── query_flags.rs
│       │   ├── query_params.rs
│       │   ├── query_params_builder.rs
│       │   ├── query_values.rs
│       │   └── utils.rs
│       ├── query.rs
│       ├── token.rs
│       ├── types/
│       │   ├── blob.rs
│       │   ├── cassandra_type.rs
│       │   ├── data_serialization_types.rs
│       │   ├── decimal.rs
│       │   ├── duration.rs
│       │   ├── from_cdrs.rs
│       │   ├── list.rs
│       │   ├── map.rs
│       │   ├── rows.rs
│       │   ├── tuple.rs
│       │   ├── udt.rs
│       │   ├── value.rs
│       │   └── vector.rs
│       └── types.rs
├── cdrs-tokio/
│   ├── Cargo.toml
│   ├── examples/
│   │   ├── README.md
│   │   ├── crud_operations.rs
│   │   ├── generic_connection.rs
│   │   ├── insert_collection.rs
│   │   ├── multiple_thread.rs
│   │   ├── paged_query.rs
│   │   └── prepare_batch_execute.rs
│   ├── src/
│   │   ├── cluster/
│   │   │   ├── cluster_metadata_manager.rs
│   │   │   ├── config_proxy.rs
│   │   │   ├── config_rustls.rs
│   │   │   ├── config_tcp.rs
│   │   │   ├── connection_manager.rs
│   │   │   ├── connection_pool.rs
│   │   │   ├── control_connection.rs
│   │   │   ├── keyspace_holder.rs
│   │   │   ├── metadata_builder.rs
│   │   │   ├── node_address.rs
│   │   │   ├── node_info.rs
│   │   │   ├── pager.rs
│   │   │   ├── rustls_connection_manager.rs
│   │   │   ├── send_envelope.rs
│   │   │   ├── session.rs
│   │   │   ├── session_context.rs
│   │   │   ├── tcp_connection_manager.rs
│   │   │   ├── token_map.rs
│   │   │   ├── topology/
│   │   │   │   ├── cluster_metadata.rs
│   │   │   │   ├── datacenter_metadata.rs
│   │   │   │   ├── keyspace_metadata.rs
│   │   │   │   ├── node.rs
│   │   │   │   ├── node_distance.rs
│   │   │   │   ├── node_state.rs
│   │   │   │   └── replication_strategy.rs
│   │   │   └── topology.rs
│   │   ├── cluster.rs
│   │   ├── envelope_parser.rs
│   │   ├── frame_encoding.rs
│   │   ├── future.rs
│   │   ├── lib.rs
│   │   ├── load_balancing/
│   │   │   ├── initializing_wrapper.rs
│   │   │   ├── node_distance_evaluator.rs
│   │   │   ├── random.rs
│   │   │   ├── request.rs
│   │   │   ├── round_robin.rs
│   │   │   └── topology_aware.rs
│   │   ├── load_balancing.rs
│   │   ├── macros.rs
│   │   ├── retry/
│   │   │   ├── reconnection_policy.rs
│   │   │   └── retry_policy.rs
│   │   ├── retry.rs
│   │   ├── speculative_execution.rs
│   │   ├── statement/
│   │   │   ├── statement_params.rs
│   │   │   └── statement_params_builder.rs
│   │   ├── statement.rs
│   │   └── transport.rs
│   └── tests/
│       ├── collection_types.rs
│       ├── common.rs
│       ├── compression.rs
│       ├── derive_traits.rs
│       ├── keyspace.rs
│       ├── multi_node_speculative_execution.rs
│       ├── multithread.rs
│       ├── native_types.rs
│       ├── paged_query.rs
│       ├── query_values.rs
│       ├── single_node_speculative_execution.rs
│       ├── topology_aware.rs
│       ├── tuple_types.rs
│       └── user_defined_types.rs
├── cdrs-tokio-helpers-derive/
│   ├── Cargo.toml
│   ├── README.md
│   └── src/
│       ├── common.rs
│       ├── db_mirror.rs
│       ├── into_cdrs_value.rs
│       ├── lib.rs
│       ├── try_from_row.rs
│       └── try_from_udt.rs
├── changelog.md
├── clippy.toml
├── documentation/
│   ├── README.md
│   ├── batching-multiple-queries.md
│   ├── cdrs-session.md
│   ├── cluster-configuration.md
│   ├── deserialization.md
│   ├── preparing-and-executing-queries.md
│   ├── query-values.md
│   └── type-mapping.md
└── rustfmt.toml

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms

github: krojew


================================================
FILE: .github/dependabot.yml
================================================
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
  - package-ecosystem: "cargo"
    directory: "/"
    schedule:
      interval: "daily"


================================================
FILE: .github/stale.yml
================================================
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
  - pinned
  - security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
  This issue has been automatically marked as stale because it has not had
  recent activity. It will be closed if no further activity occurs. Thank you
  for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false


================================================
FILE: .github/workflows/rust.yml
================================================
name: Continuous integration

on: [ push, pull_request ]

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Test Suite
    runs-on: ubuntu-latest
    services:
      cassandra:
        image: cassandra
        ports:
          - 9042:9042
    steps:
      - uses: actions/checkout@v2
      - name: Install minimal toolchain with clippy and rustfmt
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          components: rustfmt, clippy
      - name: Run tests
        # test threads must be one because else database tests will run in parallel and will result in flaky tests
        run: cargo test --all-features --verbose -- --test-threads=1
      - name: Format check
        run: cargo fmt --all -- --check
        # Ensure that all targets compile and pass clippy checks under every possible combination of features
      - name: Clippy check
        run: cargo install cargo-hack && cargo hack --feature-powerset clippy --locked --release


================================================
FILE: .gitignore
================================================
Cargo.lock
target
*.bk
.idea/
cdrs.iml
.vscode/


================================================
FILE: Cargo.toml
================================================
[workspace]
members = [
    "cassandra-protocol",
    "cdrs-tokio",
    "cdrs-tokio-helpers-derive"
]

[workspace.dependencies]
arc-swap = "1.7.1"
uuid = "1.19.0"
derivative = "2.2.0"
derive_more = { version = "2.1.0", features = ["constructor", "display"] }
itertools = "0.14.0"
thiserror = "2.0.17"


================================================
FILE: LICENSE-APACHE
================================================
                              Apache License
                        Version 2.0, January 2004
                     http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

   "License" shall mean the terms and conditions for use, reproduction,
   and distribution as defined by Sections 1 through 9 of this document.

   "Licensor" shall mean the copyright owner or entity authorized by
   the copyright owner that is granting the License.

   "Legal Entity" shall mean the union of the acting entity and all
   other entities that control, are controlled by, or are under common
   control with that entity. For the purposes of this definition,
   "control" means (i) the power, direct or indirect, to cause the
   direction or management of such entity, whether by contract or
   otherwise, or (ii) ownership of fifty percent (50%) or more of the
   outstanding shares, or (iii) beneficial ownership of such entity.

   "You" (or "Your") shall mean an individual or Legal Entity
   exercising permissions granted by this License.

   "Source" form shall mean the preferred form for making modifications,
   including but not limited to software source code, documentation
   source, and configuration files.

   "Object" form shall mean any form resulting from mechanical
   transformation or translation of a Source form, including but
   not limited to compiled object code, generated documentation,
   and conversions to other media types.

   "Work" shall mean the work of authorship, whether in Source or
   Object form, made available under the License, as indicated by a
   copyright notice that is included in or attached to the work
   (an example is provided in the Appendix below).

   "Derivative Works" shall mean any work, whether in Source or Object
   form, that is based on (or derived from) the Work and for which the
   editorial revisions, annotations, elaborations, or other modifications
   represent, as a whole, an original work of authorship. For the purposes
   of this License, Derivative Works shall not include works that remain
   separable from, or merely link (or bind by name) to the interfaces of,
   the Work and Derivative Works thereof.

   "Contribution" shall mean any work of authorship, including
   the original version of the Work and any modifications or additions
   to that Work or Derivative Works thereof, that is intentionally
   submitted to Licensor for inclusion in the Work by the copyright owner
   or by an individual or Legal Entity authorized to submit on behalf of
   the copyright owner. For the purposes of this definition, "submitted"
   means any form of electronic, verbal, or written communication sent
   to the Licensor or its representatives, including but not limited to
   communication on electronic mailing lists, source code control systems,
   and issue tracking systems that are managed by, or on behalf of, the
   Licensor for the purpose of discussing and improving the Work, but
   excluding communication that is conspicuously marked or otherwise
   designated in writing by the copyright owner as "Not a Contribution."

   "Contributor" shall mean Licensor and any individual or Legal Entity
   on behalf of whom a Contribution has been received by Licensor and
   subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
   this License, each Contributor hereby grants to You a perpetual,
   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
   copyright license to reproduce, prepare Derivative Works of,
   publicly display, publicly perform, sublicense, and distribute the
   Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
   this License, each Contributor hereby grants to You a perpetual,
   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
   (except as stated in this section) patent license to make, have made,
   use, offer to sell, sell, import, and otherwise transfer the Work,
   where such license applies only to those patent claims licensable
   by such Contributor that are necessarily infringed by their
   Contribution(s) alone or by combination of their Contribution(s)
   with the Work to which such Contribution(s) was submitted. If You
   institute patent litigation against any entity (including a
   cross-claim or counterclaim in a lawsuit) alleging that the Work
   or a Contribution incorporated within the Work constitutes direct
   or contributory patent infringement, then any patent licenses
   granted to You under this License for that Work shall terminate
   as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
   Work or Derivative Works thereof in any medium, with or without
   modifications, and in Source or Object form, provided that You
   meet the following conditions:

   (a) You must give any other recipients of the Work or
       Derivative Works a copy of this License; and

   (b) You must cause any modified files to carry prominent notices
       stating that You changed the files; and

   (c) You must retain, in the Source form of any Derivative Works
       that You distribute, all copyright, patent, trademark, and
       attribution notices from the Source form of the Work,
       excluding those notices that do not pertain to any part of
       the Derivative Works; and

   (d) If the Work includes a "NOTICE" text file as part of its
       distribution, then any Derivative Works that You distribute must
       include a readable copy of the attribution notices contained
       within such NOTICE file, excluding those notices that do not
       pertain to any part of the Derivative Works, in at least one
       of the following places: within a NOTICE text file distributed
       as part of the Derivative Works; within the Source form or
       documentation, if provided along with the Derivative Works; or,
       within a display generated by the Derivative Works, if and
       wherever such third-party notices normally appear. The contents
       of the NOTICE file are for informational purposes only and
       do not modify the License. You may add Your own attribution
       notices within Derivative Works that You distribute, alongside
       or as an addendum to the NOTICE text from the Work, provided
       that such additional attribution notices cannot be construed
       as modifying the License.

   You may add Your own copyright statement to Your modifications and
   may provide additional or different license terms and conditions
   for use, reproduction, or distribution of Your modifications, or
   for any such Derivative Works as a whole, provided Your use,
   reproduction, and distribution of the Work otherwise complies with
   the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
   any Contribution intentionally submitted for inclusion in the Work
   by You to the Licensor shall be under the terms and conditions of
   this License, without any additional terms or conditions.
   Notwithstanding the above, nothing herein shall supersede or modify
   the terms of any separate license agreement you may have executed
   with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
   names, trademarks, service marks, or product names of the Licensor,
   except as required for reasonable and customary use in describing the
   origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
   agreed to in writing, Licensor provides the Work (and each
   Contributor provides its Contributions) on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
   implied, including, without limitation, any warranties or conditions
   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
   PARTICULAR PURPOSE. You are solely responsible for determining the
   appropriateness of using or redistributing the Work and assume any
   risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
   whether in tort (including negligence), contract, or otherwise,
   unless required by applicable law (such as deliberate and grossly
   negligent acts) or agreed to in writing, shall any Contributor be
   liable to You for damages, including any direct, indirect, special,
   incidental, or consequential damages of any character arising as a
   result of this License or out of the use or inability to use the
   Work (including but not limited to damages for loss of goodwill,
   work stoppage, computer failure or malfunction, or any and all
   other commercial damages or losses), even if such Contributor
   has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
   the Work or Derivative Works thereof, You may choose to offer,
   and charge a fee for, acceptance of support, warranty, indemnity,
   or other liability obligations and/or rights consistent with this
   License. However, in accepting such obligations, You may act only
   on Your own behalf and on Your sole responsibility, not on behalf
   of any other Contributor, and only if You agree to indemnify,
   defend, and hold each Contributor harmless for any liability
   incurred by, or claims asserted against, such Contributor by reason
   of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

   To apply the Apache License to your work, attach the following
   boilerplate notice, with the fields enclosed by brackets "[]"
   replaced with your own identifying information. (Don't include
   the brackets!)  The text should be enclosed in the appropriate
   comment syntax for the file format. We also recommend that a
   file or class name and description of purpose be included on the
   same "printed page" as the copyright notice for easier
   identification within third-party archives.

Copyright 2017 CDRS Project Developers

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


================================================
FILE: LICENSE-MIT
================================================
The MIT License (MIT)

Copyright (c) 2016 CDRS Project Developers

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR
A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


================================================
FILE: README.md
================================================
# CDRS tokio

[![crates.io version](https://img.shields.io/crates/v/cdrs-tokio.svg)](https://crates.io/crates/cdrs-tokio) ![build status](https://github.com/krojew/cdrs-tokio/actions/workflows/rust.yml/badge.svg)

![CDRS tokio - async Apache Cassandra driver using tokio](./cdrs-logo.png)

CDRS is production-ready Apache **C**assandra **d**river written in pure **R**u*
*s**t. Focuses on providing high
level of configurability to suit most use cases at any scale, as its Java
counterpart, while also leveraging the
safety and performance of Rust.

## Features

- Asynchronous API;
- TCP/TLS connection (rustls);
- Topology-aware dynamic and configurable load balancing;
- Configurable connection strategies and pools;
- Configurable speculative execution;
- LZ4, Snappy compression;
- Cassandra-to-Rust data serialization/deserialization with custom type support;
- Pluggable authentication strategies;
- [ScyllaDB](https://www.scylladb.com/) support;
- Server events listening;
- Multiple CQL version support (3, 4, 5), full spec implementation;
- Query tracing information;
- Prepared statements;
- Query paging;
- Batch statements;
- Configurable retry and reconnection policy;
- Support for interleaved queries;
- Support for Yugabyte YCQL JSONB;
- Support for beta protocol usage;

## Performance

Due to high configurability of **CDRS**, the performance will vary depending on
use case. The following benchmarks
have been made against the latest (master as of 03-12-2021) versions of
respective libraries (except
cassandra-cpp: 2.16.0) and protocol version 4.

- `cdrs-tokio-large-pool` - **CDRS** with node connection pool equal to double
  of physical CPU cores
- `cdrs-tokio-small-pool` - **CDRS** with a single connection per node
- `scylladb-rust-large-pool` - `scylla` crate with node connection pool equal to
  double of physical CPU cores
- `scylladb-rust-small-pool` - `scylla` crate with a single connection per node
- `cassandra-cpp` - Rust bindings for Datastax C++ Driver, running on multiple
  threads using Tokio
- `gocql` - a driver written in Go

<img src="./perf-inserts.png" alt="insert benchmark">
<img src="./perf-selects.png" alt="select benchmark">
<img src="./perf-mixed.png" alt="mixed benchmark">

Knowing given use case, CDRS can be optimized for peak performance.

## Documentation and examples

- [User guide](./documentation).
- [Examples](./cdrs-tokio/examples).
- [API docs](https://docs.rs/cdrs-tokio/latest/cdrs_tokio/).
- Using ScyllaDB with
  RUST [lesson](https://university.scylladb.com/courses/using-scylla-drivers/lessons/rust-and-scylla/).

## Getting started

This example configures a cluster consisting of a single node without
authentication, and uses round-robin
load balancing. Other options are kept as default.

```rust
use cdrs_tokio::cluster::session::{TcpSessionBuilder, SessionBuilder};
use cdrs_tokio::cluster::NodeTcpConfigBuilder;
use cdrs_tokio::load_balancing::RoundRobinLoadBalancingStrategy;
use cdrs_tokio::query::*;

#[tokio::main]
async fn main() {
    let cluster_config = NodeTcpConfigBuilder::new()
        .with_contact_point("127.0.0.1:9042".into())
        .build()
        .await
        .unwrap();
    let session = TcpSessionBuilder::new(RoundRobinLoadBalancingStrategy::new(), cluster_config)
        .build()
        .await
        .unwrap();

    let create_ks = "CREATE KEYSPACE IF NOT EXISTS test_ks WITH REPLICATION = { \
                     'class' : 'SimpleStrategy', 'replication_factor' : 1 };";
    session
        .query(create_ks)
        .await
        .expect("Keyspace create error");
}
```

## License

This project is licensed under either of

- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)
  or [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0))
- MIT license ([LICENSE-MIT](LICENSE-MIT)
  or [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT))

at your option.


================================================
FILE: cassandra-ports.txt
================================================
Cassandra ports:

* 7199 - JMX (was 8080 pre Cassandra 0.8.xx)
* 7000 - Internode communication (not used if TLS enabled)
* 7001 - TLS Internode communication (used if TLS enabled)
* 9160 - Thrift client API
* 9042 - CQL native transport port


================================================
FILE: cassandra-protocol/Cargo.toml
================================================
[package]
name = "cassandra-protocol"
version = "4.0.0"
authors = ["Alex Pikalov <alex.pikalov.khar@gmail.com>", "Kamil Rojewski <kamil.rojewski@gmail.com>"]
edition = "2018"
description = "Cassandra protocol implementation"
documentation = "https://docs.rs/cassandra-protocol"
homepage = "https://github.com/krojew/cdrs-tokio"
repository = "https://github.com/krojew/cdrs-tokio"
keywords = ["cassandra", "client", "cassandradb"]
license = "MIT/Apache-2.0"
categories = ["asynchronous", "database"]
rust-version = "1.74"

[features]
e2e-tests = []

[dependencies]
arc-swap.workspace = true
bitflags = "2.10.0"
bytes = "1.11.0"
chrono = { version = "0.4.31", default-features = false, features = ["std"] }
crc32fast = "1.5.0"
derivative.workspace = true
derive_more.workspace = true
float_eq = "1.0.1"
integer-encoding = "4.1.0"
itertools.workspace = true
num-bigint = "0.4.1"
lz4_flex = "0.13.0"
snap = "1.1.0"
thiserror.workspace = true
time = { version = "0.3.29", features = ["macros"] }
uuid.workspace = true


================================================
FILE: cassandra-protocol/README.md
================================================
# Cassandra protocol [![crates.io version](https://img.shields.io/crates/v/cassandra-protocol.svg)](https://crates.io/crates/cassandra-protocol) ![build status](https://github.com/krojew/cdrs-tokio/actions/workflows/rust.yml/badge.svg)

**Cassandra** low-level protocol implementation, written in Rust.

If you wish to use **Cassandra** without dealing with protocol-level details, consider a high-level crate
like **[cdrs-tokio](https://crates.io/crates/cdrs-tokio)**.


================================================
FILE: cassandra-protocol/src/authenticators.rs
================================================
use crate::error::Result;
use crate::types::CBytes;

/// Handles SASL authentication.
///
/// The lifecycle of an authenticator consists of:
/// - The `initial_response` function will be called. The initial return value will be sent to the
///   server to initiate the handshake.
/// - The server will respond to each client response by either issuing a challenge or indicating
///   that the authentication is complete (successfully or not). If a new challenge is issued,
///   the authenticator's `evaluate_challenge` function will be called to produce a response
///   that will be sent to the server. This challenge/response negotiation will continue until
///   the server responds that authentication is successful or an error is raised.
/// - On success, the `handle_success` will be called with data returned by the server.
pub trait SaslAuthenticator {
    fn initial_response(&self) -> CBytes;

    fn evaluate_challenge(&self, challenge: CBytes) -> Result<CBytes>;

    fn handle_success(&self, data: CBytes) -> Result<()>;
}

/// Provides authenticators per new connection.
pub trait SaslAuthenticatorProvider {
    fn name(&self) -> Option<&str>;

    fn create_authenticator(&self) -> Box<dyn SaslAuthenticator + Send>;
}

#[derive(Debug, Clone)]
pub struct StaticPasswordAuthenticator {
    username: String,
    password: String,
}

impl StaticPasswordAuthenticator {
    pub fn new<S: ToString>(username: S, password: S) -> StaticPasswordAuthenticator {
        StaticPasswordAuthenticator {
            username: username.to_string(),
            password: password.to_string(),
        }
    }
}

impl SaslAuthenticator for StaticPasswordAuthenticator {
    fn initial_response(&self) -> CBytes {
        let mut token = vec![0];
        token.extend_from_slice(self.username.as_bytes());
        token.push(0);
        token.extend_from_slice(self.password.as_bytes());

        CBytes::new(token)
    }

    fn evaluate_challenge(&self, _challenge: CBytes) -> Result<CBytes> {
        Err("Server challenge is not supported for StaticPasswordAuthenticator!".into())
    }

    fn handle_success(&self, _data: CBytes) -> Result<()> {
        Ok(())
    }
}

/// Authentication provider with a username and password.
#[derive(Debug, Clone)]
pub struct StaticPasswordAuthenticatorProvider {
    username: String,
    password: String,
}

impl SaslAuthenticatorProvider for StaticPasswordAuthenticatorProvider {
    fn name(&self) -> Option<&str> {
        Some("org.apache.cassandra.auth.PasswordAuthenticator")
    }

    fn create_authenticator(&self) -> Box<dyn SaslAuthenticator + Send> {
        Box::new(StaticPasswordAuthenticator::new(
            self.username.clone(),
            self.password.clone(),
        ))
    }
}

impl StaticPasswordAuthenticatorProvider {
    pub fn new<S: ToString>(username: S, password: S) -> Self {
        StaticPasswordAuthenticatorProvider {
            username: username.to_string(),
            password: password.to_string(),
        }
    }
}

#[derive(Debug, Clone)]
pub struct NoneAuthenticator;

impl SaslAuthenticator for NoneAuthenticator {
    fn initial_response(&self) -> CBytes {
        CBytes::new(vec![0])
    }

    fn evaluate_challenge(&self, _challenge: CBytes) -> Result<CBytes> {
        Err("Server challenge is not supported for NoneAuthenticator!".into())
    }

    fn handle_success(&self, _data: CBytes) -> Result<()> {
        Ok(())
    }
}

/// Provider for no authentication.
#[derive(Debug, Clone)]
pub struct NoneAuthenticatorProvider;

impl SaslAuthenticatorProvider for NoneAuthenticatorProvider {
    fn name(&self) -> Option<&str> {
        None
    }

    fn create_authenticator(&self) -> Box<dyn SaslAuthenticator + Send> {
        Box::new(NoneAuthenticator)
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_static_password_authenticator_new() {
        StaticPasswordAuthenticator::new("foo", "bar");
    }

    #[test]
    fn test_static_password_authenticator_cassandra_name() {
        let auth = StaticPasswordAuthenticatorProvider::new("foo", "bar");
        assert_eq!(
            auth.name(),
            Some("org.apache.cassandra.auth.PasswordAuthenticator")
        );
    }

    #[test]
    fn test_authenticator_none_cassandra_name() {
        let auth = NoneAuthenticator;
        let provider = NoneAuthenticatorProvider;
        assert_eq!(provider.name(), None);
        assert_eq!(auth.initial_response().into_bytes().unwrap(), vec![0]);
    }
}


================================================
FILE: cassandra-protocol/src/compression.rs
================================================
/// CDRS support traffic compression as it is described in [Apache
/// Cassandra protocol](
/// https://github.com/apache/cassandra/blob/trunk/doc/native_protocol_v4.spec#L790)
///
/// Before being used, client and server must agree on a compression algorithm to
/// use, which is done in the STARTUP message. As a consequence, a STARTUP message
/// must never be compressed.  However, once the STARTUP envelope has been received
/// by the server, messages can be compressed (including the response to the STARTUP
/// request).
use derive_more::Display;
use snap::raw::{Decoder, Encoder};
use std::convert::{From, TryInto};
use std::error::Error;
use std::fmt;
use std::io;
use std::result;

type Result<T> = result::Result<T, CompressionError>;

pub const LZ4: &str = "lz4";
pub const SNAPPY: &str = "snappy";

/// An error which may occur during encoding or decoding frame body. As there are only two types
/// of compressors it contains two related enum options.
#[derive(Debug)]
pub enum CompressionError {
    /// Snappy error.
    Snappy(snap::Error),
    /// Lz4 error.
    Lz4(io::Error),
}

impl fmt::Display for CompressionError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match *self {
            CompressionError::Snappy(ref err) => write!(f, "Snappy Error: {err:?}"),
            CompressionError::Lz4(ref err) => write!(f, "Lz4 Error: {err:?}"),
        }
    }
}

impl Error for CompressionError {
    fn source(&self) -> Option<&(dyn Error + 'static)> {
        match *self {
            CompressionError::Snappy(ref err) => Some(err),
            CompressionError::Lz4(ref err) => Some(err),
        }
    }
}

impl Clone for CompressionError {
    fn clone(&self) -> Self {
        match self {
            CompressionError::Snappy(error) => CompressionError::Snappy(error.clone()),
            CompressionError::Lz4(error) => CompressionError::Lz4(io::Error::new(
                error.kind(),
                error
                    .get_ref()
                    .map(|error| error.to_string())
                    .unwrap_or_default(),
            )),
        }
    }
}

/// Enum which represents a type of compression. Only non-startup frame's body can be compressed.
#[derive(Debug, PartialEq, Clone, Copy, Eq, Ord, PartialOrd, Hash, Display)]
pub enum Compression {
    /// [lz4](https://code.google.com/p/lz4/) compression
    Lz4,
    /// [snappy](https://code.google.com/p/snappy/) compression
    Snappy,
    /// No compression
    None,
}

impl Compression {
    /// It encodes `bytes` basing on type of `Compression`..
    ///
    /// # Examples
    ///
    /// ```
    ///    use cassandra_protocol::compression::Compression;
    ///
    ///   let snappy_compression = Compression::Snappy;
    ///   let bytes = String::from("Hello World").into_bytes().to_vec();
    ///   let encoded = snappy_compression.encode(&bytes).unwrap();
    ///   assert_eq!(snappy_compression.decode(encoded).unwrap(), bytes);
    ///
    /// ```
    pub fn encode(&self, bytes: &[u8]) -> Result<Vec<u8>> {
        match *self {
            Compression::Lz4 => Compression::encode_lz4(bytes),
            Compression::Snappy => Compression::encode_snappy(bytes),
            Compression::None => Ok(bytes.into()),
        }
    }

    /// Checks if current compression actually compresses data.
    #[inline]
    pub fn is_compressed(self) -> bool {
        self != Compression::None
    }

    /// It decodes `bytes` basing on type of compression.
    pub fn decode(&self, bytes: Vec<u8>) -> Result<Vec<u8>> {
        match *self {
            Compression::Lz4 => Compression::decode_lz4(bytes),
            Compression::Snappy => Compression::decode_snappy(bytes),
            Compression::None => Ok(bytes),
        }
    }

    /// It transforms compression method into a `&str`.
    pub fn as_str(&self) -> Option<&'static str> {
        match *self {
            Compression::Lz4 => Some(LZ4),
            Compression::Snappy => Some(SNAPPY),
            Compression::None => None,
        }
    }

    fn encode_snappy(bytes: &[u8]) -> Result<Vec<u8>> {
        let mut encoder = Encoder::new();
        encoder
            .compress_vec(bytes)
            .map_err(CompressionError::Snappy)
    }

    fn decode_snappy(bytes: Vec<u8>) -> Result<Vec<u8>> {
        let mut decoder = Decoder::new();
        decoder
            .decompress_vec(bytes.as_slice())
            .map_err(CompressionError::Snappy)
    }

    fn encode_lz4(bytes: &[u8]) -> Result<Vec<u8>> {
        let len = 4 + lz4_flex::block::get_maximum_output_size(bytes.len());
        assert!(len <= i32::MAX as usize);

        let mut result = vec![0; len];

        let len = bytes.len() as i32;
        result[..4].copy_from_slice(&len.to_be_bytes());

        let compressed_len = lz4_flex::compress_into(bytes, &mut result[4..])
            .map_err(|error| CompressionError::Lz4(io::Error::other(error)))?;

        result.truncate(4 + compressed_len);
        Ok(result)
    }

    fn decode_lz4(bytes: Vec<u8>) -> Result<Vec<u8>> {
        // lz4 wire format prepends a 4-byte big-endian uncompressed length so
        // the decoder knows how much memory to allocate. Validate length before
        // slicing to avoid panics on truncated input.
        if bytes.len() < 4 {
            return Err(CompressionError::Lz4(io::Error::new(
                io::ErrorKind::UnexpectedEof,
                "lz4 payload missing 4-byte uncompressed length header",
            )));
        }

        let uncompressed_size = i32::from_be_bytes(
            bytes[..4]
                .try_into()
                .map_err(|error| CompressionError::Lz4(io::Error::other(error)))?,
        );

        // a negative size is impossible for a real payload; without this check
        // the `as usize` cast would silently turn it into ~2 GB+ and ask
        // lz4_flex to allocate a buffer that size before any decoding begins.
        if uncompressed_size < 0 {
            return Err(CompressionError::Lz4(io::Error::new(
                io::ErrorKind::InvalidData,
                format!("negative uncompressed size {uncompressed_size}"),
            )));
        }

        lz4_flex::decompress(&bytes[4..], uncompressed_size as usize)
            .map_err(|error| CompressionError::Lz4(io::Error::other(error)))
    }
}

impl From<String> for Compression {
    /// It converts `String` into `Compression`. If string is neither `lz4` nor `snappy` then
    /// `Compression::None` will be returned
    fn from(compression_string: String) -> Compression {
        Compression::from(compression_string.as_str())
    }
}

impl Compression {
    /// It converts `Compression` into `String`. If compression is `None` then empty string will be
    /// returned
    pub fn to_protocol_string(self) -> String {
        match self {
            Compression::Lz4 => "LZ4".to_string(),
            Compression::Snappy => "SNAPPY".to_string(),
            Compression::None => "NONE".to_string(),
        }
    }

    pub fn from_protocol_string(protocol_string: &str) -> std::result::Result<Self, String> {
        match protocol_string {
            "lz4" | "LZ4" => Ok(Compression::Lz4),
            "snappy" | "SNAPPY" => Ok(Compression::Snappy),
            "none" | "NONE" => Ok(Compression::None),
            _ => Err("Unknown compression".to_string()),
        }
    }
}

impl<'a> From<&'a str> for Compression {
    /// It converts `str` into `Compression`. If string is neither `lz4` nor `snappy` then
    /// `Compression::None` will be returned
    fn from(compression_str: &'a str) -> Compression {
        match compression_str {
            LZ4 => Compression::Lz4,
            SNAPPY => Compression::Snappy,
            _ => Compression::None,
        }
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_compression_to_protocol_string() {
        let lz4 = Compression::Lz4;
        assert_eq!("LZ4", lz4.to_protocol_string());

        let snappy = Compression::Snappy;
        assert_eq!("SNAPPY", snappy.to_protocol_string());

        let none = Compression::None;
        assert_eq!("NONE", none.to_protocol_string());
    }

    #[test]
    fn test_compression_from_protocol_str() {
        let lz4 = "lz4";
        assert_eq!(
            Compression::from_protocol_string(lz4).unwrap(),
            Compression::Lz4
        );

        let lz4 = "LZ4";
        assert_eq!(
            Compression::from_protocol_string(lz4).unwrap(),
            Compression::Lz4
        );

        let snappy = "snappy";
        assert_eq!(
            Compression::from_protocol_string(snappy).unwrap(),
            Compression::Snappy
        );

        let snappy = "SNAPPY";
        assert_eq!(
            Compression::from_protocol_string(snappy).unwrap(),
            Compression::Snappy
        );

        let none = "none";
        assert_eq!(
            Compression::from_protocol_string(none).unwrap(),
            Compression::None
        );

        let none = "NONE";
        assert_eq!(
            Compression::from_protocol_string(none).unwrap(),
            Compression::None
        );
    }

    #[test]
    fn test_compression_from_string() {
        let lz4 = "lz4".to_string();
        assert_eq!(Compression::from(lz4), Compression::Lz4);
        let snappy = "snappy".to_string();
        assert_eq!(Compression::from(snappy), Compression::Snappy);
        let none = "x".to_string();
        assert_eq!(Compression::from(none), Compression::None);
    }

    #[test]
    fn test_compression_encode_snappy() {
        let snappy_compression = Compression::Snappy;
        let bytes = String::from("Hello World").into_bytes().to_vec();
        snappy_compression
            .encode(&bytes)
            .expect("Should work without exceptions");
    }

    #[test]
    fn test_compression_decode_snappy() {
        let snappy_compression = Compression::Snappy;
        let bytes = String::from("Hello World").into_bytes().to_vec();
        let encoded = snappy_compression.encode(&bytes).unwrap();
        assert_eq!(snappy_compression.decode(encoded).unwrap(), bytes);
    }

    #[test]
    fn test_compression_encode_lz4() {
        let snappy_compression = Compression::Lz4;
        let bytes = String::from("Hello World").into_bytes().to_vec();
        snappy_compression
            .encode(&bytes)
            .expect("Should work without exceptions");
    }

    #[test]
    fn test_compression_decode_lz4() {
        let lz4_compression = Compression::Lz4;
        let bytes = String::from("Hello World").into_bytes().to_vec();
        let encoded = lz4_compression.encode(&bytes).unwrap();
        assert_eq!(lz4_compression.decode(encoded).unwrap(), bytes);
    }

    #[test]
    fn test_compression_encode_none() {
        let none_compression = Compression::None;
        let bytes = String::from("Hello World").into_bytes().to_vec();
        none_compression
            .encode(&bytes)
            .expect("Should work without exceptions");
    }

    #[test]
    fn test_compression_decode_none() {
        let none_compression = Compression::None;
        let bytes = String::from("Hello World").into_bytes().to_vec();
        let encoded = none_compression.encode(&bytes).unwrap();
        assert_eq!(none_compression.decode(encoded).unwrap(), bytes);
    }

    #[test]
    fn test_compression_decode_lz4_with_invalid_input() {
        let lz4_compression = Compression::Lz4;
        let decode = lz4_compression.decode(vec![0, 0, 0, 0x7f]);
        assert!(decode.is_err());
    }

    #[test]
    fn test_compression_decode_lz4_short_input_is_error_not_panic() {
        // the lz4 wire format prepends a 4-byte big-endian uncompressed size;
        // a payload shorter than that header must surface as an error rather
        // than panicking on `bytes[..4]` slicing.
        let lz4_compression = Compression::Lz4;
        assert!(lz4_compression.decode(vec![]).is_err());
        assert!(lz4_compression.decode(vec![1, 2, 3]).is_err());
    }

    #[test]
    fn test_compression_decode_lz4_negative_size_is_error_not_oom() {
        // a negative i32 uncompressed length cast through `as usize` becomes
        // a huge value (~2 GB+) and would otherwise hand lz4_flex an absurd
        // allocation request - guard against that.
        let lz4_compression = Compression::Lz4;
        // -1 in big-endian i32 followed by a dummy compressed byte
        let bytes = vec![0xff, 0xff, 0xff, 0xff, 0];
        assert!(lz4_compression.decode(bytes).is_err());
    }

    #[test]
    fn test_compression_encode_snappy_with_non_utf8() {
        let snappy_compression = Compression::Snappy;
        let v = vec![0xff, 0xff];
        let encoded = snappy_compression
            .encode(&v)
            .expect("Should work without exceptions");
        assert_eq!(snappy_compression.decode(encoded).unwrap(), v);
    }
}


================================================
FILE: cassandra-protocol/src/consistency.rs
================================================
#![warn(missing_docs)]
//! The module contains Rust representation of Cassandra consistency levels.
use crate::error;
use crate::frame::{FromBytes, FromCursor, Serialize, Version};
use crate::types::*;
use derive_more::Display;
use std::convert::{From, TryFrom, TryInto};
use std::default::Default;
use std::io;
use std::str::FromStr;

/// `Consistency` is an enum which represents Cassandra's consistency levels.
/// To find more details about each consistency level please refer to the following documentation:
/// <https://docs.datastax.com/en/cql-oss/3.x/cql/cql_reference/cqlshConsistency.html>
#[derive(Debug, PartialEq, Clone, Copy, Display, Ord, PartialOrd, Eq, Hash, Default)]
#[non_exhaustive]
pub enum Consistency {
    /// Closest replica, as determined by the snitch.
    /// If all replica nodes are down, write succeeds after a hinted handoff.
    /// Provides low latency, guarantees writes never fail.
    /// Note: this consistency level can only be used for writes.
    /// It provides the lowest consistency and the highest availability.
    Any,
    ///
    /// A write must be written to the commit log and memtable of at least one replica node.
    /// Satisfies the needs of most users because consistency requirements are not stringent.
    #[default]
    One,
    /// A write must be written to the commit log and memtable of at least two replica nodes.
    /// Similar to ONE.
    Two,
    /// A write must be written to the commit log and memtable of at least three replica nodes.
    /// Similar to TWO.
    Three,
    /// A write must be written to the commit log and memtable on a quorum of replica nodes.
    /// Provides strong consistency if you can tolerate some level of failure.
    Quorum,
    /// A write must be written to the commit log and memtable on all replica nodes in the cluster
    /// for that partition key.
    /// Provides the highest consistency and the lowest availability of any other level.
    All,
    /// Strong consistency. A write must be written to the commit log and memtable on a quorum
    /// of replica nodes in the same data center as thecoordinator node.
    /// Avoids latency of inter-data center communication.
    /// Used in multiple data center clusters with a rack-aware replica placement strategy,
    /// such as NetworkTopologyStrategy, and a properly configured snitch.
    /// Use to maintain consistency locally (within the single data center).
    /// Can be used with SimpleStrategy.
    LocalQuorum,
    /// Strong consistency. A write must be written to the commit log and memtable on a quorum of
    /// replica nodes in all data center.
    /// Used in multiple data center clusters to strictly maintain consistency at the same level
    /// in each data center. For example, choose this level
    /// if you want a read to fail when a data center is down and the QUORUM
    /// cannot be reached on that data center.
    EachQuorum,
    /// Achieves linearizable consistency for lightweight transactions by preventing unconditional
    /// updates. You cannot configure this level as a normal consistency level,
    /// configured at the driver level using the consistency level field.
    /// You configure this level using the serial consistency field
    /// as part of the native protocol operation. See failure scenarios.
    Serial,
    /// Same as SERIAL but confined to the data center. A write must be written conditionally
    /// to the commit log and memtable on a quorum of replica nodes in the same data center.
    /// Same as SERIAL. Used for disaster recovery. See failure scenarios.
    LocalSerial,
    /// A write must be sent to, and successfully acknowledged by,
    /// at least one replica node in the local data center.
    /// In a multiple data center clusters, a consistency level of ONE is often desirable,
    /// but cross-DC traffic is not. LOCAL_ONE accomplishes this.
    /// For security and quality reasons, you can use this consistency level
    /// in an offline datacenter to prevent automatic connection
    /// to online nodes in other data centers if an offline node goes down.
    LocalOne,
}

impl FromStr for Consistency {
    type Err = error::Error;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let consistency = match s {
            "Any" => Consistency::Any,
            "One" => Consistency::One,
            "Two" => Consistency::Two,
            "Three" => Consistency::Three,
            "Quorum" => Consistency::Quorum,
            "All" => Consistency::All,
            "LocalQuorum" => Consistency::LocalQuorum,
            "EachQuorum" => Consistency::EachQuorum,
            "Serial" => Consistency::Serial,
            "LocalSerial" => Consistency::LocalSerial,
            "LocalOne" => Consistency::LocalOne,
            _ => {
                return Err(error::Error::General(format!(
                    "Invalid consistency provided: {s}"
                )))
            }
        };

        Ok(consistency)
    }
}

impl Serialize for Consistency {
    fn serialize(&self, cursor: &mut io::Cursor<&mut Vec<u8>>, version: Version) {
        let value: i16 = (*self).into();
        value.serialize(cursor, version)
    }
}

impl TryFrom<CIntShort> for Consistency {
    type Error = error::Error;

    fn try_from(value: CIntShort) -> Result<Self, Self::Error> {
        match value {
            0x0000 => Ok(Consistency::Any),
            0x0001 => Ok(Consistency::One),
            0x0002 => Ok(Consistency::Two),
            0x0003 => Ok(Consistency::Three),
            0x0004 => Ok(Consistency::Quorum),
            0x0005 => Ok(Consistency::All),
            0x0006 => Ok(Consistency::LocalQuorum),
            0x0007 => Ok(Consistency::EachQuorum),
            0x0008 => Ok(Consistency::Serial),
            0x0009 => Ok(Consistency::LocalSerial),
            0x000A => Ok(Consistency::LocalOne),
            _ => Err(Self::Error::UnknownConsistency(value)),
        }
    }
}

impl From<Consistency> for CIntShort {
    fn from(value: Consistency) -> Self {
        match value {
            Consistency::Any => 0x0000,
            Consistency::One => 0x0001,
            Consistency::Two => 0x0002,
            Consistency::Three => 0x0003,
            Consistency::Quorum => 0x0004,
            Consistency::All => 0x0005,
            Consistency::LocalQuorum => 0x0006,
            Consistency::EachQuorum => 0x0007,
            Consistency::Serial => 0x0008,
            Consistency::LocalSerial => 0x0009,
            Consistency::LocalOne => 0x000A,
        }
    }
}

impl FromBytes for Consistency {
    fn from_bytes(bytes: &[u8]) -> error::Result<Consistency> {
        try_i16_from_bytes(bytes)
            .map_err(Into::into)
            .and_then(TryInto::try_into)
    }
}

impl FromCursor for Consistency {
    fn from_cursor(cursor: &mut io::Cursor<&[u8]>, version: Version) -> error::Result<Consistency> {
        CIntShort::from_cursor(cursor, version).and_then(TryInto::try_into)
    }
}

impl Consistency {
    /// Does this consistency require local dc.
    #[inline]
    pub fn is_dc_local(self) -> bool {
        matches!(
            self,
            Consistency::LocalOne | Consistency::LocalQuorum | Consistency::LocalSerial
        )
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::frame::traits::{FromBytes, FromCursor};
    use std::io::Cursor;

    #[test]
    fn test_consistency_serialize() {
        assert_eq!(Consistency::Any.serialize_to_vec(Version::V4), &[0, 0]);
        assert_eq!(Consistency::One.serialize_to_vec(Version::V4), &[0, 1]);
        assert_eq!(Consistency::Two.serialize_to_vec(Version::V4), &[0, 2]);
        assert_eq!(Consistency::Three.serialize_to_vec(Version::V4), &[0, 3]);
        assert_eq!(Consistency::Quorum.serialize_to_vec(Version::V4), &[0, 4]);
        assert_eq!(Consistency::All.serialize_to_vec(Version::V4), &[0, 5]);
        assert_eq!(
            Consistency::LocalQuorum.serialize_to_vec(Version::V4),
            &[0, 6]
        );
        assert_eq!(
            Consistency::EachQuorum.serialize_to_vec(Version::V4),
            &[0, 7]
        );
        assert_eq!(Consistency::Serial.serialize_to_vec(Version::V4), &[0, 8]);
        assert_eq!(
            Consistency::LocalSerial.serialize_to_vec(Version::V4),
            &[0, 9]
        );
        assert_eq!(
            Consistency::LocalOne.serialize_to_vec(Version::V4),
            &[0, 10]
        );
    }

    #[test]
    fn test_consistency_from() {
        assert_eq!(Consistency::try_from(0).unwrap(), Consistency::Any);
        assert_eq!(Consistency::try_from(1).unwrap(), Consistency::One);
        assert_eq!(Consistency::try_from(2).unwrap(), Consistency::Two);
        assert_eq!(Consistency::try_from(3).unwrap(), Consistency::Three);
        assert_eq!(Consistency::try_from(4).unwrap(), Consistency::Quorum);
        assert_eq!(Consistency::try_from(5).unwrap(), Consistency::All);
        assert_eq!(Consistency::try_from(6).unwrap(), Consistency::LocalQuorum);
        assert_eq!(Consistency::try_from(7).unwrap(), Consistency::EachQuorum);
        assert_eq!(Consistency::try_from(8).unwrap(), Consistency::Serial);
        assert_eq!(Consistency::try_from(9).unwrap(), Consistency::LocalSerial);
        assert_eq!(Consistency::try_from(10).unwrap(), Consistency::LocalOne);
    }

    #[test]
    fn test_consistency_from_bytes() {
        assert_eq!(Consistency::from_bytes(&[0, 0]).unwrap(), Consistency::Any);
        assert_eq!(Consistency::from_bytes(&[0, 1]).unwrap(), Consistency::One);
        assert_eq!(Consistency::from_bytes(&[0, 2]).unwrap(), Consistency::Two);
        assert_eq!(
            Consistency::from_bytes(&[0, 3]).unwrap(),
            Consistency::Three
        );
        assert_eq!(
            Consistency::from_bytes(&[0, 4]).unwrap(),
            Consistency::Quorum
        );
        assert_eq!(Consistency::from_bytes(&[0, 5]).unwrap(), Consistency::All);
        assert_eq!(
            Consistency::from_bytes(&[0, 6]).unwrap(),
            Consistency::LocalQuorum
        );
        assert_eq!(
            Consistency::from_bytes(&[0, 7]).unwrap(),
            Consistency::EachQuorum
        );
        assert_eq!(
            Consistency::from_bytes(&[0, 8]).unwrap(),
            Consistency::Serial
        );
        assert_eq!(
            Consistency::from_bytes(&[0, 9]).unwrap(),
            Consistency::LocalSerial
        );
        assert_eq!(
            Consistency::from_bytes(&[0, 10]).unwrap(),
            Consistency::LocalOne
        );
        assert!(Consistency::from_bytes(&[0, 11]).is_err());
    }

    #[test]
    fn test_consistency_from_cursor() {
        assert_eq!(
            Consistency::from_cursor(&mut Cursor::new(&[0, 0]), Version::V4).unwrap(),
            Consistency::Any
        );
        assert_eq!(
            Consistency::from_cursor(&mut Cursor::new(&[0, 1]), Version::V4).unwrap(),
            Consistency::One
        );
        assert_eq!(
            Consistency::from_cursor(&mut Cursor::new(&[0, 2]), Version::V4).unwrap(),
            Consistency::Two
        );
        assert_eq!(
            Consistency::from_cursor(&mut Cursor::new(&[0, 3]), Version::V4).unwrap(),
            Consistency::Three
        );
        assert_eq!(
            Consistency::from_cursor(&mut Cursor::new(&[0, 4]), Version::V4).unwrap(),
            Consistency::Quorum
        );
        assert_eq!(
            Consistency::from_cursor(&mut Cursor::new(&[0, 5]), Version::V4).unwrap(),
            Consistency::All
        );
        assert_eq!(
            Consistency::from_cursor(&mut Cursor::new(&[0, 6]), Version::V4).unwrap(),
            Consistency::LocalQuorum
        );
        assert_eq!(
            Consistency::from_cursor(&mut Cursor::new(&[0, 7]), Version::V4).unwrap(),
            Consistency::EachQuorum
        );
        assert_eq!(
            Consistency::from_cursor(&mut Cursor::new(&[0, 8]), Version::V4).unwrap(),
            Consistency::Serial
        );
        assert_eq!(
            Consistency::from_cursor(&mut Cursor::new(&[0, 9]), Version::V4).unwrap(),
            Consistency::LocalSerial
        );
        assert_eq!(
            Consistency::from_cursor(&mut Cursor::new(&[0, 10]), Version::V4).unwrap(),
            Consistency::LocalOne
        );
    }
}


================================================
FILE: cassandra-protocol/src/crc.rs
================================================
use crc32fast::Hasher;

const CRC24_POLY: i32 = 0x1974f0b;
const CRC24_INIT: i32 = 0x875060;

/// Computes crc24 value of `bytes`.
pub fn crc24(bytes: &[u8]) -> i32 {
    bytes.iter().fold(CRC24_INIT, |mut crc, byte| {
        crc ^= (*byte as i32) << 16;

        for _ in 0..8 {
            crc <<= 1;
            if (crc & 0x1000000) != 0 {
                crc ^= CRC24_POLY;
            }
        }

        crc
    })
}

/// Computes crc32 value of `bytes`.
pub fn crc32(bytes: &[u8]) -> u32 {
    let mut hasher = Hasher::new();
    hasher.update(&[0xfa, 0x2d, 0x55, 0xca]); // Cassandra appends a few bytes and forgets to mention it in the spec...
    hasher.update(bytes);
    hasher.finalize()
}


================================================
FILE: cassandra-protocol/src/error.rs
================================================
use crate::compression::CompressionError;
use crate::frame::message_error::ErrorBody;
use crate::frame::Opcode;
use crate::types::{CInt, CIntShort};
use std::fmt::{Debug, Display};
use std::io;
use std::net::SocketAddr;
use std::result;
use std::str::Utf8Error;
use std::string::FromUtf8Error;
use thiserror::Error as ThisError;
use uuid::Error as UuidError;

pub type Result<T> = result::Result<T, Error>;

/// CDRS custom error type. CDRS expects two types of error - errors returned by Server
/// and internal errors occurred within the driver itself. Occasionally `io::Error`
/// is a type that represent internal error because due to implementation IO errors only
/// can be raised by CDRS driver. `Server` error is an error which are ones returned by
/// a Server via result error frames.
#[derive(Debug, ThisError)]
#[non_exhaustive]
pub enum Error {
    /// Internal IO error.
    #[error("IO error: {0}")]
    Io(#[from] io::Error),
    /// Internal error that may be raised during `uuid::Uuid::from_bytes`
    #[error("Uuid parse error: {0}")]
    UuidParse(#[from] UuidError),
    /// General error
    #[error("General error: {0}")]
    General(String),
    /// Internal error that may be raised during `String::from_utf8`
    #[error("FromUtf8 error: {0}")]
    FromUtf8(#[from] FromUtf8Error),
    /// Internal error that may be raised during `str::from_utf8`
    #[error("Utf8 error: {0}")]
    Utf8(#[from] Utf8Error),
    /// Internal Compression/Decompression error.
    #[error("Compressor error: {0}")]
    Compression(#[from] CompressionError),
    /// Server error.
    #[error("Server {addr} error: {body:?}")]
    Server { body: ErrorBody, addr: SocketAddr },
    /// Timed out waiting for an operation to complete.
    #[error("Timeout: {0}")]
    Timeout(String),
    /// Unknown consistency.
    #[error("Unknown consistency: {0}")]
    UnknownConsistency(CIntShort),
    /// Unknown server event.
    #[error("Unknown server event: {0}")]
    UnknownServerEvent(String),
    /// Unexpected topology change event type.
    #[error("Unexpected topology change type: {0}")]
    UnexpectedTopologyChangeType(String),
    /// Unexpected status change event type.
    #[error("Unexpected status change type: {0}")]
    UnexpectedStatusChangeType(String),
    /// Unexpected schema change event type.
    #[error("Unexpected schema change type: {0}")]
    UnexpectedSchemaChangeType(String),
    /// Unexpected schema change event target.
    #[error("Unexpected schema change target: {0}")]
    UnexpectedSchemaChangeTarget(String),
    /// Unexpected additional error info.
    #[error("Unexpected error code: {0}")]
    UnexpectedErrorCode(CInt),
    /// Unexpected write type.
    #[error("Unexpected write type: {0}")]
    UnexpectedWriteType(String),
    /// Expected a request opcode, got something else.
    #[error("Opcode is not a request: {0}")]
    NonRequestOpcode(Opcode),
    /// Expected a response opcode, got something else.
    #[error("Opcode is not a response: {0}")]
    NonResponseOpcode(Opcode),
    /// Unexpected result kind.
    #[error("Unexpected result kind: {0}")]
    UnexpectedResultKind(CInt),
    /// Unexpected column type.
    #[error("Unexpected column type: {0}")]
    UnexpectedColumnType(CIntShort),
    /// Invalid format found for given keyspace replication strategy.
    #[error("Invalid replication format for: {keyspace}")]
    InvalidReplicationFormat { keyspace: String },
    /// Unexpected response to auth message.
    #[error("Unexpected auth response: {0}")]
    UnexpectedAuthResponse(Opcode),
    /// Unexpected startup response.
    #[error("Unexpected startup response: {0}")]
    UnexpectedStartupResponse(Opcode),
    /// Special error for cases when starting up a connection and protocol negotiation fails. There
    /// currently is no explicit server-side code for this, so the information must be inferred from
    /// returned error response.
    #[error("Invalid protocol used when communicating with a node: {0}")]
    InvalidProtocol(SocketAddr),
}

pub fn column_is_empty_err<T: Display>(column_name: T) -> Error {
    Error::General(format!("Column or Udt property '{column_name}' is empty"))
}

impl From<String> for Error {
    fn from(err: String) -> Error {
        Error::General(err)
    }
}

impl From<&str> for Error {
    fn from(err: &str) -> Error {
        Error::General(err.to_string())
    }
}

impl Clone for Error {
    fn clone(&self) -> Self {
        match self {
            Error::Io(error) => Error::Io(io::Error::new(
                error.kind(),
                error
                    .get_ref()
                    .map(|error| error.to_string())
                    .unwrap_or_default(),
            )),
            Error::UuidParse(error) => Error::UuidParse(error.clone()),
            Error::General(error) => Error::General(error.clone()),
            Error::FromUtf8(error) => Error::FromUtf8(error.clone()),
            Error::Utf8(error) => Error::Utf8(*error),
            Error::Compression(error) => Error::Compression(error.clone()),
            Error::Server { body, addr } => Error::Server {
                body: body.clone(),
                addr: *addr,
            },
            Error::Timeout(error) => Error::Timeout(error.clone()),
            Error::UnknownConsistency(value) => Error::UnknownConsistency(*value),
            Error::UnknownServerEvent(value) => Error::UnknownServerEvent(value.clone()),
            Error::UnexpectedTopologyChangeType(value) => {
                Error::UnexpectedTopologyChangeType(value.clone())
            }
            Error::UnexpectedStatusChangeType(value) => {
                Error::UnexpectedStatusChangeType(value.clone())
            }
            Error::UnexpectedSchemaChangeType(value) => {
                Error::UnexpectedSchemaChangeType(value.clone())
            }
            Error::UnexpectedSchemaChangeTarget(value) => {
                Error::UnexpectedSchemaChangeTarget(value.clone())
            }
            Error::UnexpectedErrorCode(value) => Error::UnexpectedErrorCode(*value),
            Error::UnexpectedWriteType(value) => Error::UnexpectedWriteType(value.clone()),
            Error::NonRequestOpcode(value) => Error::NonRequestOpcode(*value),
            Error::NonResponseOpcode(value) => Error::NonResponseOpcode(*value),
            Error::UnexpectedResultKind(value) => Error::UnexpectedResultKind(*value),
            Error::UnexpectedColumnType(value) => Error::UnexpectedColumnType(*value),
            Error::InvalidReplicationFormat { keyspace } => Error::InvalidReplicationFormat {
                keyspace: keyspace.clone(),
            },
            Error::UnexpectedAuthResponse(value) => Error::UnexpectedAuthResponse(*value),
            Error::UnexpectedStartupResponse(value) => Error::UnexpectedStartupResponse(*value),
            Error::InvalidProtocol(addr) => Error::InvalidProtocol(*addr),
        }
    }
}


================================================
FILE: cassandra-protocol/src/events.rs
================================================
use crate::frame::events::{
    SchemaChange as MessageSchemaChange, ServerEvent as MessageServerEvent,
    SimpleServerEvent as MessageSimpleServerEvent,
};

/// Full Server Event which includes all details about occurred change.
pub type ServerEvent = MessageServerEvent;

/// Simplified Server event. It should be used to represent an event
/// which consumer wants listen to.
pub type SimpleServerEvent = MessageSimpleServerEvent;

/// Reexport of `MessageSchemaChange`.
pub type SchemaChange = MessageSchemaChange;


================================================
FILE: cassandra-protocol/src/frame/events.rs
================================================
use crate::frame::traits::FromCursor;
use crate::frame::{Serialize, Version};
use crate::types::{from_cursor_str, from_cursor_string_list, serialize_str, CIntShort};
use crate::{error, Error};
use derive_more::Display;
use std::cmp::PartialEq;
use std::convert::TryFrom;
use std::io::Cursor;
use std::net::SocketAddr;

// Event types
const TOPOLOGY_CHANGE: &str = "TOPOLOGY_CHANGE";
const STATUS_CHANGE: &str = "STATUS_CHANGE";
const SCHEMA_CHANGE: &str = "SCHEMA_CHANGE";

// Topology changes
const NEW_NODE: &str = "NEW_NODE";
const REMOVED_NODE: &str = "REMOVED_NODE";

// Status changes
const UP: &str = "UP";
const DOWN: &str = "DOWN";

// Schema changes
const CREATED: &str = "CREATED";
const UPDATED: &str = "UPDATED";
const DROPPED: &str = "DROPPED";

// Schema change targets
const KEYSPACE: &str = "KEYSPACE";
const TABLE: &str = "TABLE";
const TYPE: &str = "TYPE";
const FUNCTION: &str = "FUNCTION";
const AGGREGATE: &str = "AGGREGATE";

/// Simplified `ServerEvent` that does not contain details
/// about a concrete change. It may be useful for subscription
/// when you need only string representation of an event.
#[derive(Debug, PartialEq, Copy, Clone, Ord, PartialOrd, Eq, Hash)]
#[non_exhaustive]
pub enum SimpleServerEvent {
    TopologyChange,
    StatusChange,
    SchemaChange,
}

impl SimpleServerEvent {
    pub fn as_str(&self) -> &'static str {
        match *self {
            SimpleServerEvent::TopologyChange => TOPOLOGY_CHANGE,
            SimpleServerEvent::StatusChange => STATUS_CHANGE,
            SimpleServerEvent::SchemaChange => SCHEMA_CHANGE,
        }
    }
}

impl From<ServerEvent> for SimpleServerEvent {
    fn from(event: ServerEvent) -> SimpleServerEvent {
        match event {
            ServerEvent::TopologyChange(_) => SimpleServerEvent::TopologyChange,
            ServerEvent::StatusChange(_) => SimpleServerEvent::StatusChange,
            ServerEvent::SchemaChange(_) => SimpleServerEvent::SchemaChange,
        }
    }
}

impl<'a> From<&'a ServerEvent> for SimpleServerEvent {
    fn from(event: &'a ServerEvent) -> SimpleServerEvent {
        match *event {
            ServerEvent::TopologyChange(_) => SimpleServerEvent::TopologyChange,
            ServerEvent::StatusChange(_) => SimpleServerEvent::StatusChange,
            ServerEvent::SchemaChange(_) => SimpleServerEvent::SchemaChange,
        }
    }
}

impl TryFrom<&str> for SimpleServerEvent {
    type Error = error::Error;

    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            TOPOLOGY_CHANGE => Ok(SimpleServerEvent::TopologyChange),
            STATUS_CHANGE => Ok(SimpleServerEvent::StatusChange),
            SCHEMA_CHANGE => Ok(SimpleServerEvent::SchemaChange),
            value => Err(Error::UnknownServerEvent(value.into())),
        }
    }
}

impl PartialEq<ServerEvent> for SimpleServerEvent {
    fn eq(&self, full_event: &ServerEvent) -> bool {
        self == &SimpleServerEvent::from(full_event)
    }
}

/// Full server event that contains all details about a concrete change.
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
#[non_exhaustive]
pub enum ServerEvent {
    /// Events related to change in the cluster topology
    TopologyChange(TopologyChange),
    /// Events related to change of node status.
    StatusChange(StatusChange),
    /// Events related to schema change.
    SchemaChange(SchemaChange),
}

impl Serialize for ServerEvent {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        match &self {
            ServerEvent::TopologyChange(t) => {
                serialize_str(cursor, TOPOLOGY_CHANGE, version);
                t.serialize(cursor, version);
            }
            ServerEvent::StatusChange(s) => {
                serialize_str(cursor, STATUS_CHANGE, version);
                s.serialize(cursor, version);
            }
            ServerEvent::SchemaChange(s) => {
                serialize_str(cursor, SCHEMA_CHANGE, version);
                s.serialize(cursor, version);
            }
        }
    }
}

impl PartialEq<SimpleServerEvent> for ServerEvent {
    fn eq(&self, event: &SimpleServerEvent) -> bool {
        &SimpleServerEvent::from(self) == event
    }
}

impl FromCursor for ServerEvent {
    fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::Result<ServerEvent> {
        let event_type = from_cursor_str(cursor)?;
        match event_type {
            TOPOLOGY_CHANGE => Ok(ServerEvent::TopologyChange(TopologyChange::from_cursor(
                cursor, version,
            )?)),
            STATUS_CHANGE => Ok(ServerEvent::StatusChange(StatusChange::from_cursor(
                cursor, version,
            )?)),
            SCHEMA_CHANGE => Ok(ServerEvent::SchemaChange(SchemaChange::from_cursor(
                cursor, version,
            )?)),
            _ => Err(Error::UnknownServerEvent(event_type.into())),
        }
    }
}

/// Events related to change in the cluster topology
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct TopologyChange {
    pub change_type: TopologyChangeType,
    pub addr: SocketAddr,
}

impl Serialize for TopologyChange {
    //noinspection DuplicatedCode
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        self.change_type.serialize(cursor, version);
        self.addr.serialize(cursor, version);
    }
}

impl FromCursor for TopologyChange {
    fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::Result<TopologyChange> {
        let change_type = TopologyChangeType::from_cursor(cursor, version)?;
        let addr = SocketAddr::from_cursor(cursor, version)?;

        Ok(TopologyChange { change_type, addr })
    }
}

#[derive(Debug, Copy, Clone, PartialEq, Ord, PartialOrd, Eq, Hash, Display)]
#[non_exhaustive]
pub enum TopologyChangeType {
    NewNode,
    RemovedNode,
}

impl Serialize for TopologyChangeType {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        match &self {
            TopologyChangeType::NewNode => serialize_str(cursor, NEW_NODE, version),
            TopologyChangeType::RemovedNode => serialize_str(cursor, REMOVED_NODE, version),
        }
    }
}

impl FromCursor for TopologyChangeType {
    fn from_cursor(
        cursor: &mut Cursor<&[u8]>,
        _version: Version,
    ) -> error::Result<TopologyChangeType> {
        from_cursor_str(cursor).and_then(|tc| match tc {
            NEW_NODE => Ok(TopologyChangeType::NewNode),
            REMOVED_NODE => Ok(TopologyChangeType::RemovedNode),
            _ => Err(Error::UnexpectedTopologyChangeType(tc.into())),
        })
    }
}

/// Events related to change of node status.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct StatusChange {
    pub change_type: StatusChangeType,
    pub addr: SocketAddr,
}

impl Serialize for StatusChange {
    //noinspection DuplicatedCode
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        self.change_type.serialize(cursor, version);
        self.addr.serialize(cursor, version);
    }
}

impl FromCursor for StatusChange {
    fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::Result<StatusChange> {
        let change_type = StatusChangeType::from_cursor(cursor, version)?;
        let addr = SocketAddr::from_cursor(cursor, version)?;

        Ok(StatusChange { change_type, addr })
    }
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Display)]
#[non_exhaustive]
pub enum StatusChangeType {
    Up,
    Down,
}

impl Serialize for StatusChangeType {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        match self {
            StatusChangeType::Up => serialize_str(cursor, UP, version),
            StatusChangeType::Down => serialize_str(cursor, DOWN, version),
        }
    }
}

impl FromCursor for StatusChangeType {
    fn from_cursor(
        cursor: &mut Cursor<&[u8]>,
        _version: Version,
    ) -> error::Result<StatusChangeType> {
        from_cursor_str(cursor).and_then(|sct| match sct {
            UP => Ok(StatusChangeType::Up),
            DOWN => Ok(StatusChangeType::Down),
            _ => Err(Error::UnexpectedStatusChangeType(sct.into())),
        })
    }
}

/// Events related to schema change.
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub struct SchemaChange {
    pub change_type: SchemaChangeType,
    pub target: SchemaChangeTarget,
    pub options: SchemaChangeOptions,
}

impl Serialize for SchemaChange {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        self.change_type.serialize(cursor, version);
        self.target.serialize(cursor, version);
        self.options.serialize(cursor, version);
    }
}

impl FromCursor for SchemaChange {
    fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::Result<SchemaChange> {
        let change_type = SchemaChangeType::from_cursor(cursor, version)?;
        let target = SchemaChangeTarget::from_cursor(cursor, version)?;
        let options = SchemaChangeOptions::from_cursor_and_target(cursor, &target)?;

        Ok(SchemaChange {
            change_type,
            target,
            options,
        })
    }
}

/// Represents type of changes.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Display)]
#[non_exhaustive]
pub enum SchemaChangeType {
    Created,
    Updated,
    Dropped,
}

impl Serialize for SchemaChangeType {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        match self {
            SchemaChangeType::Created => serialize_str(cursor, CREATED, version),
            SchemaChangeType::Updated => serialize_str(cursor, UPDATED, version),
            SchemaChangeType::Dropped => serialize_str(cursor, DROPPED, version),
        }
    }
}

impl FromCursor for SchemaChangeType {
    fn from_cursor(
        cursor: &mut Cursor<&[u8]>,
        _version: Version,
    ) -> error::Result<SchemaChangeType> {
        from_cursor_str(cursor).and_then(|ct| match ct {
            CREATED => Ok(SchemaChangeType::Created),
            UPDATED => Ok(SchemaChangeType::Updated),
            DROPPED => Ok(SchemaChangeType::Dropped),
            _ => Err(Error::UnexpectedSchemaChangeType(ct.into())),
        })
    }
}

/// Refers to a target of changes were made.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Display)]
#[non_exhaustive]
pub enum SchemaChangeTarget {
    Keyspace,
    Table,
    Type,
    Function,
    Aggregate,
}

impl Serialize for SchemaChangeTarget {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        match self {
            SchemaChangeTarget::Keyspace => serialize_str(cursor, KEYSPACE, version),
            SchemaChangeTarget::Table => serialize_str(cursor, TABLE, version),
            SchemaChangeTarget::Type => serialize_str(cursor, TYPE, version),
            SchemaChangeTarget::Function => serialize_str(cursor, FUNCTION, version),
            SchemaChangeTarget::Aggregate => serialize_str(cursor, AGGREGATE, version),
        }
    }
}

impl FromCursor for SchemaChangeTarget {
    fn from_cursor(
        cursor: &mut Cursor<&[u8]>,
        _version: Version,
    ) -> error::Result<SchemaChangeTarget> {
        from_cursor_str(cursor).and_then(|t| match t {
            KEYSPACE => Ok(SchemaChangeTarget::Keyspace),
            TABLE => Ok(SchemaChangeTarget::Table),
            TYPE => Ok(SchemaChangeTarget::Type),
            FUNCTION => Ok(SchemaChangeTarget::Function),
            AGGREGATE => Ok(SchemaChangeTarget::Aggregate),
            _ => Err(Error::UnexpectedSchemaChangeTarget(t.into())),
        })
    }
}

/// Information about changes made.
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
#[non_exhaustive]
pub enum SchemaChangeOptions {
    /// Changes related to keyspaces. Contains keyspace name.
    Keyspace(String),
    /// Changes related to tables. Contains keyspace and table names.
    TableType(String, String),
    /// Changes related to functions and aggregations. Contains:
    /// * keyspace containing the user defined function/aggregate
    /// * the function/aggregate name
    /// * list of strings, one string for each argument type (as CQL type)
    FunctionAggregate(String, String, Vec<String>),
}

impl Serialize for SchemaChangeOptions {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        match self {
            SchemaChangeOptions::Keyspace(ks) => {
                serialize_str(cursor, ks, version);
            }
            SchemaChangeOptions::TableType(ks, t) => {
                serialize_str(cursor, ks, version);
                serialize_str(cursor, t, version);
            }
            SchemaChangeOptions::FunctionAggregate(ks, fa_name, list) => {
                serialize_str(cursor, ks, version);
                serialize_str(cursor, fa_name, version);

                let len = list.len() as CIntShort;
                len.serialize(cursor, version);
                list.iter().for_each(|x| serialize_str(cursor, x, version));
            }
        }
    }
}

impl SchemaChangeOptions {
    fn from_cursor_and_target(
        cursor: &mut Cursor<&[u8]>,
        target: &SchemaChangeTarget,
    ) -> error::Result<SchemaChangeOptions> {
        Ok(match *target {
            SchemaChangeTarget::Keyspace => SchemaChangeOptions::from_cursor_keyspace(cursor)?,
            SchemaChangeTarget::Table | SchemaChangeTarget::Type => {
                SchemaChangeOptions::from_cursor_table_type(cursor)?
            }
            SchemaChangeTarget::Function | SchemaChangeTarget::Aggregate => {
                SchemaChangeOptions::from_cursor_function_aggregate(cursor)?
            }
        })
    }

    fn from_cursor_keyspace(cursor: &mut Cursor<&[u8]>) -> error::Result<SchemaChangeOptions> {
        Ok(SchemaChangeOptions::Keyspace(
            from_cursor_str(cursor)?.to_string(),
        ))
    }

    fn from_cursor_table_type(cursor: &mut Cursor<&[u8]>) -> error::Result<SchemaChangeOptions> {
        let keyspace = from_cursor_str(cursor)?.to_string();
        let name = from_cursor_str(cursor)?.to_string();
        Ok(SchemaChangeOptions::TableType(keyspace, name))
    }

    fn from_cursor_function_aggregate(
        cursor: &mut Cursor<&[u8]>,
    ) -> error::Result<SchemaChangeOptions> {
        let keyspace = from_cursor_str(cursor)?.to_string();
        let name = from_cursor_str(cursor)?.to_string();
        let types = from_cursor_string_list(cursor)?;
        Ok(SchemaChangeOptions::FunctionAggregate(
            keyspace, name, types,
        ))
    }
}

#[cfg(test)]
fn test_encode_decode(bytes: &[u8], expected: ServerEvent) {
    let mut ks: Cursor<&[u8]> = Cursor::new(bytes);
    let event = ServerEvent::from_cursor(&mut ks, Version::V4).unwrap();
    assert_eq!(expected, event);

    let mut buffer = Vec::new();
    let mut cursor = Cursor::new(&mut buffer);
    expected.serialize(&mut cursor, Version::V4);
    assert_eq!(buffer, bytes);
}

#[cfg(test)]
mod topology_change_type_test {
    use super::*;
    use crate::frame::traits::FromCursor;
    use std::io::Cursor;

    #[test]
    fn from_cursor() {
        let a = &[0, 8, 78, 69, 87, 95, 78, 79, 68, 69];
        let mut new_node: Cursor<&[u8]> = Cursor::new(a);
        assert_eq!(
            TopologyChangeType::from_cursor(&mut new_node, Version::V4).unwrap(),
            TopologyChangeType::NewNode
        );

        let b = &[0, 12, 82, 69, 77, 79, 86, 69, 68, 95, 78, 79, 68, 69];
        let mut removed_node: Cursor<&[u8]> = Cursor::new(b);
        assert_eq!(
            TopologyChangeType::from_cursor(&mut removed_node, Version::V4).unwrap(),
            TopologyChangeType::RemovedNode
        );
    }

    #[test]
    fn serialize() {
        {
            let a = &[0, 8, 78, 69, 87, 95, 78, 79, 68, 69];
            let mut buffer = Vec::new();
            let mut cursor = Cursor::new(&mut buffer);
            let new_node = TopologyChangeType::NewNode;
            new_node.serialize(&mut cursor, Version::V4);
            assert_eq!(buffer, a);
        }

        {
            let b = &[0, 12, 82, 69, 77, 79, 86, 69, 68, 95, 78, 79, 68, 69];
            let mut buffer = Vec::new();
            let mut cursor = Cursor::new(&mut buffer);
            let removed_node = TopologyChangeType::RemovedNode;
            removed_node.serialize(&mut cursor, Version::V4);
            assert_eq!(buffer, b);
        }
    }

    #[test]
    #[should_panic]
    fn from_cursor_wrong() {
        let a = &[0, 1, 78];
        let mut wrong: Cursor<&[u8]> = Cursor::new(a);
        let _ = TopologyChangeType::from_cursor(&mut wrong, Version::V4).unwrap();
    }
}

#[cfg(test)]
mod status_change_type_test {
    use super::*;
    use crate::frame::traits::FromCursor;
    use std::io::Cursor;

    #[test]
    fn from_cursor() {
        let a = &[0, 2, 85, 80];
        let mut up: Cursor<&[u8]> = Cursor::new(a);
        assert_eq!(
            StatusChangeType::from_cursor(&mut up, Version::V4).unwrap(),
            StatusChangeType::Up
        );

        let b = &[0, 4, 68, 79, 87, 78];
        let mut down: Cursor<&[u8]> = Cursor::new(b);
        assert_eq!(
            StatusChangeType::from_cursor(&mut down, Version::V4).unwrap(),
            StatusChangeType::Down
        );
    }

    #[test]
    fn serialize() {
        {
            let a = &[0, 2, 85, 80];
            let mut buffer = Vec::new();
            let mut cursor = Cursor::new(&mut buffer);
            let up = StatusChangeType::Up;
            up.serialize(&mut cursor, Version::V4);
            assert_eq!(buffer, a);
        }

        {
            let b = &[0, 4, 68, 79, 87, 78];
            let mut buffer = Vec::new();
            let mut cursor = Cursor::new(&mut buffer);
            let down = StatusChangeType::Down;
            down.serialize(&mut cursor, Version::V4);
            assert_eq!(buffer, b);
        }
    }

    #[test]
    fn from_cursor_wrong() {
        let a = &[0, 1, 78];
        let mut wrong: Cursor<&[u8]> = Cursor::new(a);
        let err = StatusChangeType::from_cursor(&mut wrong, Version::V4).unwrap_err();

        assert!(matches!(err, Error::UnexpectedStatusChangeType(_)));
    }
}

#[cfg(test)]
mod schema_change_type_test {
    use super::*;
    use crate::frame::traits::FromCursor;
    use std::io::Cursor;

    #[test]
    fn from_cursor() {
        let a = &[0, 7, 67, 82, 69, 65, 84, 69, 68];
        let mut created: Cursor<&[u8]> = Cursor::new(a);
        assert_eq!(
            SchemaChangeType::from_cursor(&mut created, Version::V4).unwrap(),
            SchemaChangeType::Created
        );

        let b = &[0, 7, 85, 80, 68, 65, 84, 69, 68];
        let mut updated: Cursor<&[u8]> = Cursor::new(b);
        assert_eq!(
            SchemaChangeType::from_cursor(&mut updated, Version::V4).unwrap(),
            SchemaChangeType::Updated
        );

        let c = &[0, 7, 68, 82, 79, 80, 80, 69, 68];
        let mut dropped: Cursor<&[u8]> = Cursor::new(c);
        assert_eq!(
            SchemaChangeType::from_cursor(&mut dropped, Version::V4).unwrap(),
            SchemaChangeType::Dropped
        );
    }

    #[test]
    fn serialize() {
        {
            let a = &[0, 7, 67, 82, 69, 65, 84, 69, 68];
            let mut buffer = Vec::new();
            let mut cursor = Cursor::new(&mut buffer);
            let created = SchemaChangeType::Created;
            created.serialize(&mut cursor, Version::V4);
            assert_eq!(buffer, a);
        }
        {
            let b = &[0, 7, 85, 80, 68, 65, 84, 69, 68];
            let mut buffer = Vec::new();
            let mut cursor = Cursor::new(&mut buffer);
            let updated = SchemaChangeType::Updated;
            updated.serialize(&mut cursor, Version::V4);
            assert_eq!(buffer, b);
        }

        {
            let c = &[0, 7, 68, 82, 79, 80, 80, 69, 68];
            let mut buffer = Vec::new();
            let mut cursor = Cursor::new(&mut buffer);
            let dropped = SchemaChangeType::Dropped;
            dropped.serialize(&mut cursor, Version::V4);
            assert_eq!(buffer, c);
        }
    }

    #[test]
    #[should_panic]
    fn from_cursor_wrong() {
        let a = &[0, 1, 78];
        let mut wrong: Cursor<&[u8]> = Cursor::new(a);
        let _ = SchemaChangeType::from_cursor(&mut wrong, Version::V4).unwrap();
    }
}

#[cfg(test)]
mod schema_change_target_test {
    use super::*;
    use crate::frame::traits::FromCursor;
    use std::io::Cursor;

    #[test]
    #[allow(clippy::many_single_char_names)]
    fn schema_change_target() {
        {
            let bytes = &[0, 8, 75, 69, 89, 83, 80, 65, 67, 69];
            let mut keyspace: Cursor<&[u8]> = Cursor::new(bytes);
            assert_eq!(
                SchemaChangeTarget::from_cursor(&mut keyspace, Version::V4).unwrap(),
                SchemaChangeTarget::Keyspace
            );
        }

        let b = &[0, 5, 84, 65, 66, 76, 69];
        let mut table: Cursor<&[u8]> = Cursor::new(b);
        assert_eq!(
            SchemaChangeTarget::from_cursor(&mut table, Version::V4).unwrap(),
            SchemaChangeTarget::Table
        );

        let c = &[0, 4, 84, 89, 80, 69];
        let mut _type: Cursor<&[u8]> = Cursor::new(c);
        assert_eq!(
            SchemaChangeTarget::from_cursor(&mut _type, Version::V4).unwrap(),
            SchemaChangeTarget::Type
        );

        let d = &[0, 8, 70, 85, 78, 67, 84, 73, 79, 78];
        let mut function: Cursor<&[u8]> = Cursor::new(d);
        assert_eq!(
            SchemaChangeTarget::from_cursor(&mut function, Version::V4).unwrap(),
            SchemaChangeTarget::Function
        );

        let e = &[0, 9, 65, 71, 71, 82, 69, 71, 65, 84, 69];
        let mut aggregate: Cursor<&[u8]> = Cursor::new(e);
        assert_eq!(
            SchemaChangeTarget::from_cursor(&mut aggregate, Version::V4).unwrap(),
            SchemaChangeTarget::Aggregate
        );
    }

    #[test]
    fn serialize() {
        {
            let a = &[0, 8, 75, 69, 89, 83, 80, 65, 67, 69];
            let mut buffer = Vec::new();
            let mut cursor = Cursor::new(&mut buffer);
            let keyspace = SchemaChangeTarget::Keyspace;
            keyspace.serialize(&mut cursor, Version::V4);
            assert_eq!(buffer, a);
        }

        {
            let b = &[0, 5, 84, 65, 66, 76, 69];
            let mut buffer = Vec::new();
            let mut cursor = Cursor::new(&mut buffer);
            let table = SchemaChangeTarget::Table;
            table.serialize(&mut cursor, Version::V4);
            assert_eq!(buffer, b);
        }

        {
            let c = &[0, 4, 84, 89, 80, 69];
            let mut buffer = Vec::new();
            let mut cursor = Cursor::new(&mut buffer);
            let target_type = SchemaChangeTarget::Type;
            target_type.serialize(&mut cursor, Version::V4);
            assert_eq!(buffer, c);
        }

        {
            let d = &[0, 8, 70, 85, 78, 67, 84, 73, 79, 78];
            let mut buffer = Vec::new();
            let mut cursor = Cursor::new(&mut buffer);
            let function = SchemaChangeTarget::Function;
            function.serialize(&mut cursor, Version::V4);
            assert_eq!(buffer, d);
        }

        {
            let e = &[0, 9, 65, 71, 71, 82, 69, 71, 65, 84, 69];
            let mut buffer = Vec::new();
            let mut cursor = Cursor::new(&mut buffer);
            let aggregate = SchemaChangeTarget::Aggregate;
            aggregate.serialize(&mut cursor, Version::V4);
            assert_eq!(buffer, e);
        }
    }

    #[test]
    #[should_panic]
    fn from_cursor_wrong() {
        let a = &[0, 1, 78];
        let mut wrong: Cursor<&[u8]> = Cursor::new(a);
        let _ = SchemaChangeTarget::from_cursor(&mut wrong, Version::V4).unwrap();
    }
}

#[cfg(test)]
mod server_event {
    use super::*;

    #[test]
    fn topology_change_new_node() {
        let bytes = &[
            // topology change
            0, 15, 84, 79, 80, 79, 76, 79, 71, 89, 95, 67, 72, 65, 78, 71, 69, // new node
            0, 8, 78, 69, 87, 95, 78, 79, 68, 69, //
            4, 127, 0, 0, 1, 0, 0, 0, 1, // 127.0.0.1:1
        ];

        let expected = ServerEvent::TopologyChange(TopologyChange {
            change_type: TopologyChangeType::NewNode,
            addr: "127.0.0.1:1".parse().unwrap(),
        });

        test_encode_decode(bytes, expected);
    }

    #[test]
    fn topology_change_removed_node() {
        let bytes = &[
            // topology change
            0, 15, 84, 79, 80, 79, 76, 79, 71, 89, 95, 67, 72, 65, 78, 71, 69,
            // removed node
            0, 12, 82, 69, 77, 79, 86, 69, 68, 95, 78, 79, 68, 69, //
            4, 127, 0, 0, 1, 0, 0, 0, 1, // 127.0.0.1:1
        ];

        let expected = ServerEvent::TopologyChange(TopologyChange {
            change_type: TopologyChangeType::RemovedNode,
            addr: "127.0.0.1:1".parse().unwrap(),
        });

        test_encode_decode(bytes, expected);
    }

    #[test]
    fn status_change_up() {
        let bytes = &[
            // status change
            0, 13, 83, 84, 65, 84, 85, 83, 95, 67, 72, 65, 78, 71, 69, // up
            0, 2, 85, 80, //
            4, 127, 0, 0, 1, 0, 0, 0, 1, // 127.0.0.1:1
        ];

        let expected = ServerEvent::StatusChange(StatusChange {
            change_type: StatusChangeType::Up,
            addr: "127.0.0.1:1".parse().unwrap(),
        });

        test_encode_decode(bytes, expected);
    }

    #[test]
    fn status_change_down() {
        let bytes = &[
            // status change
            0, 13, 83, 84, 65, 84, 85, 83, 95, 67, 72, 65, 78, 71, 69, // down
            0, 4, 68, 79, 87, 78, //
            4, 127, 0, 0, 1, 0, 0, 0, 1, // 127.0.0.1:1
        ];

        let expected = ServerEvent::StatusChange(StatusChange {
            change_type: StatusChangeType::Down,
            addr: "127.0.0.1:1".parse().unwrap(),
        });

        test_encode_decode(bytes, expected);
    }

    #[test]
    fn schema_change_created() {
        // keyspace
        {
            let bytes = &[
                // schema change
                0, 13, 83, 67, 72, 69, 77, 65, 95, 67, 72, 65, 78, 71, 69, // created
                0, 7, 67, 82, 69, 65, 84, 69, 68, // keyspace
                0, 8, 75, 69, 89, 83, 80, 65, 67, 69, // my_ks
                0, 5, 109, 121, 95, 107, 115,
            ];
            let expected = ServerEvent::SchemaChange(SchemaChange {
                change_type: SchemaChangeType::Created,
                target: SchemaChangeTarget::Keyspace,
                options: SchemaChangeOptions::Keyspace("my_ks".to_string()),
            });

            test_encode_decode(bytes, expected);
        }

        // table
        {
            let bytes = &[
                // schema change
                0, 13, 83, 67, 72, 69, 77, 65, 95, 67, 72, 65, 78, 71, 69, // created
                0, 7, 67, 82, 69, 65, 84, 69, 68, // table
                0, 5, 84, 65, 66, 76, 69, // my_ks
                0, 5, 109, 121, 95, 107, 115, // my_table
                0, 8, 109, 121, 95, 116, 97, 98, 108, 101,
            ];
            let expected = ServerEvent::SchemaChange(SchemaChange {
                change_type: SchemaChangeType::Created,
                target: SchemaChangeTarget::Table,
                options: SchemaChangeOptions::TableType(
                    "my_ks".to_string(),
                    "my_table".to_string(),
                ),
            });
            test_encode_decode(bytes, expected);
        }

        // type
        {
            let bytes = &[
                // schema change
                0, 13, 83, 67, 72, 69, 77, 65, 95, 67, 72, 65, 78, 71, 69, // created
                0, 7, 67, 82, 69, 65, 84, 69, 68, // type
                0, 4, 84, 89, 80, 69, // my_ks
                0, 5, 109, 121, 95, 107, 115, // my_table
                0, 8, 109, 121, 95, 116, 97, 98, 108, 101,
            ];
            let expected = ServerEvent::SchemaChange(SchemaChange {
                change_type: SchemaChangeType::Created,
                target: SchemaChangeTarget::Type,
                options: SchemaChangeOptions::TableType(
                    "my_ks".to_string(),
                    "my_table".to_string(),
                ),
            });
            test_encode_decode(bytes, expected);
        }

        {
            // function
            let bytes = &[
                // schema change
                0, 13, 83, 67, 72, 69, 77, 65, 95, 67, 72, 65, 78, 71, 69, // created
                0, 7, 67, 82, 69, 65, 84, 69, 68, // function
                0, 8, 70, 85, 78, 67, 84, 73, 79, 78, // my_ks
                0, 5, 109, 121, 95, 107, 115, // name
                0, 4, 110, 97, 109, 101, // empty list of parameters
                0, 0,
            ];
            let expected = ServerEvent::SchemaChange(SchemaChange {
                change_type: SchemaChangeType::Created,
                target: SchemaChangeTarget::Function,
                options: SchemaChangeOptions::FunctionAggregate(
                    "my_ks".to_string(),
                    "name".to_string(),
                    Vec::new(),
                ),
            });
            test_encode_decode(bytes, expected);
        }

        {
            // aggregate
            let bytes = &[
                // schema change
                0, 13, 83, 67, 72, 69, 77, 65, 95, 67, 72, 65, 78, 71, 69, // created
                0, 7, 67, 82, 69, 65, 84, 69, 68, // aggregate
                0, 9, 65, 71, 71, 82, 69, 71, 65, 84, 69, // my_ks
                0, 5, 109, 121, 95, 107, 115, // name
                0, 4, 110, 97, 109, 101, // empty list of parameters
                0, 0,
            ];
            let expected = ServerEvent::SchemaChange(SchemaChange {
                change_type: SchemaChangeType::Created,
                target: SchemaChangeTarget::Aggregate,
                options: SchemaChangeOptions::FunctionAggregate(
                    "my_ks".to_string(),
                    "name".to_string(),
                    Vec::new(),
                ),
            });
            test_encode_decode(bytes, expected);
        }
    }

    #[test]
    fn schema_change_updated() {
        // keyspace
        {
            let bytes = &[
                // schema change
                0, 13, 83, 67, 72, 69, 77, 65, 95, 67, 72, 65, 78, 71, 69, // updated
                0, 7, 85, 80, 68, 65, 84, 69, 68, // keyspace
                0, 8, 75, 69, 89, 83, 80, 65, 67, 69, // my_ks
                0, 5, 109, 121, 95, 107, 115,
            ];
            let expected = ServerEvent::SchemaChange(SchemaChange {
                change_type: SchemaChangeType::Updated,
                target: SchemaChangeTarget::Keyspace,
                options: SchemaChangeOptions::Keyspace("my_ks".to_string()),
            });
            test_encode_decode(bytes, expected);
        }

        // table
        {
            let bytes = &[
                // schema change
                0, 13, 83, 67, 72, 69, 77, 65, 95, 67, 72, 65, 78, 71, 69, // updated
                0, 7, 85, 80, 68, 65, 84, 69, 68, // table
                0, 5, 84, 65, 66, 76, 69, // my_ks
                0, 5, 109, 121, 95, 107, 115, // my_table
                0, 8, 109, 121, 95, 116, 97, 98, 108, 101,
            ];
            let expected = ServerEvent::SchemaChange(SchemaChange {
                change_type: SchemaChangeType::Updated,
                target: SchemaChangeTarget::Table,
                options: SchemaChangeOptions::TableType(
                    "my_ks".to_string(),
                    "my_table".to_string(),
                ),
            });
            test_encode_decode(bytes, expected);
        }

        // type
        {
            let bytes = &[
                // schema change
                0, 13, 83, 67, 72, 69, 77, 65, 95, 67, 72, 65, 78, 71, 69, // updated
                0, 7, 85, 80, 68, 65, 84, 69, 68, // type
                0, 4, 84, 89, 80, 69, // my_ks
                0, 5, 109, 121, 95, 107, 115, // my_table
                0, 8, 109, 121, 95, 116, 97, 98, 108, 101,
            ];
            let expected = ServerEvent::SchemaChange(SchemaChange {
                change_type: SchemaChangeType::Updated,
                target: SchemaChangeTarget::Type,
                options: SchemaChangeOptions::TableType(
                    "my_ks".to_string(),
                    "my_table".to_string(),
                ),
            });
            test_encode_decode(bytes, expected);
        }

        // function
        {
            let bytes = &[
                // schema change
                0, 13, 83, 67, 72, 69, 77, 65, 95, 67, 72, 65, 78, 71, 69, // updated
                0, 7, 85, 80, 68, 65, 84, 69, 68, // function
                0, 8, 70, 85, 78, 67, 84, 73, 79, 78, // my_ks
                0, 5, 109, 121, 95, 107, 115, // name
                0, 4, 110, 97, 109, 101, // empty list of parameters
                0, 0,
            ];
            let expected = ServerEvent::SchemaChange(SchemaChange {
                change_type: SchemaChangeType::Updated,
                target: SchemaChangeTarget::Function,
                options: SchemaChangeOptions::FunctionAggregate(
                    "my_ks".to_string(),
                    "name".to_string(),
                    Vec::new(),
                ),
            });
            test_encode_decode(bytes, expected);
        }

        // aggreate
        {
            let bytes = &[
                // schema change
                0, 13, 83, 67, 72, 69, 77, 65, 95, 67, 72, 65, 78, 71, 69, // updated
                0, 7, 85, 80, 68, 65, 84, 69, 68, // aggregate
                0, 9, 65, 71, 71, 82, 69, 71, 65, 84, 69, // my_ks
                0, 5, 109, 121, 95, 107, 115, // name
                0, 4, 110, 97, 109, 101, // empty list of parameters
                0, 0,
            ];
            let expected = ServerEvent::SchemaChange(SchemaChange {
                change_type: SchemaChangeType::Updated,
                target: SchemaChangeTarget::Aggregate,
                options: SchemaChangeOptions::FunctionAggregate(
                    "my_ks".to_string(),
                    "name".to_string(),
                    Vec::new(),
                ),
            });
            test_encode_decode(bytes, expected);
        }
    }

    #[test]
    fn schema_change_dropped() {
        // keyspace
        {
            let bytes = &[
                // schema change
                0, 13, 83, 67, 72, 69, 77, 65, 95, 67, 72, 65, 78, 71, 69, // dropped
                0, 7, 68, 82, 79, 80, 80, 69, 68, // keyspace
                0, 8, 75, 69, 89, 83, 80, 65, 67, 69, // my_ks
                0, 5, 109, 121, 95, 107, 115,
            ];
            let expected = ServerEvent::SchemaChange(SchemaChange {
                change_type: SchemaChangeType::Dropped,
                target: SchemaChangeTarget::Keyspace,
                options: SchemaChangeOptions::Keyspace("my_ks".to_string()),
            });
            test_encode_decode(bytes, expected);
        }

        // table
        {
            let bytes = &[
                // schema change
                0, 13, 83, 67, 72, 69, 77, 65, 95, 67, 72, 65, 78, 71, 69, // dropped
                0, 7, 68, 82, 79, 80, 80, 69, 68, // table
                0, 5, 84, 65, 66, 76, 69, // my_ks
                0, 5, 109, 121, 95, 107, 115, // my_table
                0, 8, 109, 121, 95, 116, 97, 98, 108, 101,
            ];
            let expected = ServerEvent::SchemaChange(SchemaChange {
                change_type: SchemaChangeType::Dropped,
                target: SchemaChangeTarget::Table,
                options: SchemaChangeOptions::TableType(
                    "my_ks".to_string(),
                    "my_table".to_string(),
                ),
            });
            test_encode_decode(bytes, expected);
        }

        // type
        {
            let bytes = &[
                // schema change
                0, 13, 83, 67, 72, 69, 77, 65, 95, 67, 72, 65, 78, 71, 69, // dropped
                0, 7, 68, 82, 79, 80, 80, 69, 68, // type
                0, 4, 84, 89, 80, 69, // my_ks
                0, 5, 109, 121, 95, 107, 115, // my_table
                0, 8, 109, 121, 95, 116, 97, 98, 108, 101,
            ];
            let expected = ServerEvent::SchemaChange(SchemaChange {
                change_type: SchemaChangeType::Dropped,
                target: SchemaChangeTarget::Type,
                options: SchemaChangeOptions::TableType(
                    "my_ks".to_string(),
                    "my_table".to_string(),
                ),
            });
            test_encode_decode(bytes, expected);
        }

        // function
        {
            let bytes = &[
                // schema change
                0, 13, 83, 67, 72, 69, 77, 65, 95, 67, 72, 65, 78, 71, 69, // dropped
                0, 7, 68, 82, 79, 80, 80, 69, 68, // function
                0, 8, 70, 85, 78, 67, 84, 73, 79, 78, // my_ks
                0, 5, 109, 121, 95, 107, 115, // name
                0, 4, 110, 97, 109, 101, // empty list of parameters
                0, 0,
            ];
            let expected = ServerEvent::SchemaChange(SchemaChange {
                change_type: SchemaChangeType::Dropped,
                target: SchemaChangeTarget::Function,
                options: SchemaChangeOptions::FunctionAggregate(
                    "my_ks".to_string(),
                    "name".to_string(),
                    Vec::new(),
                ),
            });
            test_encode_decode(bytes, expected);
        }

        // function
        {
            let bytes = &[
                // schema change
                0, 13, 83, 67, 72, 69, 77, 65, 95, 67, 72, 65, 78, 71, 69, // dropped
                0, 7, 68, 82, 79, 80, 80, 69, 68, // aggregate
                0, 9, 65, 71, 71, 82, 69, 71, 65, 84, 69, // my_ks
                0, 5, 109, 121, 95, 107, 115, // name
                0, 4, 110, 97, 109, 101, // empty list of parameters
                0, 0,
            ];
            let expected = ServerEvent::SchemaChange(SchemaChange {
                change_type: SchemaChangeType::Dropped,
                target: SchemaChangeTarget::Aggregate,
                options: SchemaChangeOptions::FunctionAggregate(
                    "my_ks".to_string(),
                    "name".to_string(),
                    Vec::new(),
                ),
            });
            test_encode_decode(bytes, expected);
        }
    }
}


================================================
FILE: cassandra-protocol/src/frame/frame_decoder.rs
================================================
use crate::compression::{Compression, CompressionError};
use crate::crc::{crc24, crc32};
use crate::error::{Error, Result};
use crate::frame::{
    Envelope, ParseEnvelopeError, COMPRESSED_FRAME_HEADER_LENGTH, ENVELOPE_HEADER_LEN,
    FRAME_TRAILER_LENGTH, MAX_FRAME_SIZE, PAYLOAD_SIZE_LIMIT, UNCOMPRESSED_FRAME_HEADER_LENGTH,
};
use lz4_flex::decompress;
use std::convert::TryInto;
use std::io;

#[inline]
fn create_unexpected_self_contained_error() -> Error {
    "Found self-contained frame while waiting for non self-contained continuation!".into()
}

#[inline]
fn create_header_crc_mismatch_error(computed_crc: i32, header_crc24: i32) -> Error {
    format!("Header CRC mismatch - expected {header_crc24}, found {computed_crc}.",).into()
}

#[inline]
fn create_payload_crc_mismatch_error(computed_crc: u32, payload_crc32: u32) -> Error {
    format!("Payload CRC mismatch - read {payload_crc32}, computed {computed_crc}.",).into()
}

fn extract_envelopes(buffer: &[u8], compression: Compression) -> Result<(usize, Vec<Envelope>)> {
    let mut current_pos = 0;
    let mut envelopes = vec![];

    loop {
        match Envelope::from_buffer(&buffer[current_pos..], compression) {
            Ok(envelope) => {
                envelopes.push(envelope.envelope);
                current_pos += envelope.envelope_len;
            }
            Err(ParseEnvelopeError::NotEnoughBytes) => break,
            Err(error) => return Err(error.to_string().into()),
        }
    }

    Ok((current_pos, envelopes))
}

fn try_decode_envelopes_with_spare_data(
    buffer: &mut Vec<u8>,
    compression: Compression,
) -> Result<(Vec<Envelope>, Vec<u8>)> {
    let (current_pos, envelopes) = extract_envelopes(buffer.as_slice(), compression)?;
    Ok((envelopes, buffer.split_off(current_pos)))
}

fn try_decode_envelopes_without_spare_data(buffer: &[u8]) -> Result<Vec<Envelope>> {
    let (_, envelopes) = extract_envelopes(buffer, Compression::None)?;
    Ok(envelopes)
}

/// A decoder for frames. Since protocol v5, frames became "envelopes" and a frame now can contain
/// multiple complete envelopes (self-contained frame) or a part of one bigger envelope.
pub trait FrameDecoder {
    /// Consumes some data and returns decoded envelopes. Decoders can be stateful, so data can be
    /// buffered until envelopes can be parsed.
    /// The buffer passed in should be cleared of consumed data by the decoder.
    fn consume(&mut self, data: &mut Vec<u8>, compression: Compression) -> Result<Vec<Envelope>>;
}

/// Pre-V5 frame decoder which simply decodes one envelope directly into a buffer.
#[derive(Clone, Debug)]
pub struct LegacyFrameDecoder {
    buffer: Vec<u8>,
}

impl Default for LegacyFrameDecoder {
    fn default() -> Self {
        Self {
            buffer: Vec::with_capacity(MAX_FRAME_SIZE),
        }
    }
}

impl FrameDecoder for LegacyFrameDecoder {
    fn consume(&mut self, data: &mut Vec<u8>, compression: Compression) -> Result<Vec<Envelope>> {
        if self.buffer.is_empty() {
            // optimistic case
            let (envelopes, buffer) = try_decode_envelopes_with_spare_data(data, compression)?;

            self.buffer = buffer;
            data.clear();

            return Ok(envelopes);
        }

        self.buffer.append(data);

        let (envelopes, buffer) =
            try_decode_envelopes_with_spare_data(&mut self.buffer, compression)?;

        self.buffer = buffer;
        Ok(envelopes)
    }
}

/// Post-V5 Lz4 decoder with support for envelope frames with CRC checksum.
#[derive(Clone, Debug, Default)]
pub struct Lz4FrameDecoder {
    inner_decoder: GenericFrameDecoder,
}

impl FrameDecoder for Lz4FrameDecoder {
    //noinspection DuplicatedCode
    #[inline]
    fn consume(&mut self, data: &mut Vec<u8>, _compression: Compression) -> Result<Vec<Envelope>> {
        self.inner_decoder.consume(data, Self::try_decode_frame)
    }
}

impl Lz4FrameDecoder {
    fn try_decode_frame(buffer: &mut Vec<u8>) -> Result<Option<(bool, Vec<u8>)>> {
        let buffer_len = buffer.len();
        if buffer_len < COMPRESSED_FRAME_HEADER_LENGTH {
            return Ok(None);
        }

        let header =
            i64::from_le_bytes(buffer[..COMPRESSED_FRAME_HEADER_LENGTH].try_into().unwrap());

        let header_crc24 = ((header >> 40) & 0xffffff) as i32;
        let computed_crc = crc24(&header.to_le_bytes()[..5]);

        if header_crc24 != computed_crc {
            return Err(create_header_crc_mismatch_error(computed_crc, header_crc24));
        }

        let compressed_length = (header & 0x1ffff) as usize;
        let compressed_payload_end = compressed_length + COMPRESSED_FRAME_HEADER_LENGTH;

        let frame_end = compressed_payload_end + FRAME_TRAILER_LENGTH;
        if buffer_len < frame_end {
            return Ok(None);
        }

        let compressed_payload_crc32 = u32::from_le_bytes(
            buffer[compressed_payload_end..frame_end]
                .try_into()
                .unwrap(),
        );

        let computed_crc = crc32(&buffer[COMPRESSED_FRAME_HEADER_LENGTH..compressed_payload_end]);

        if compressed_payload_crc32 != computed_crc {
            return Err(create_payload_crc_mismatch_error(
                computed_crc,
                compressed_payload_crc32,
            ));
        }

        let self_contained = (header & (1 << 34)) != 0;
        let uncompressed_length = ((header >> 17) & 0x1ffff) as usize;

        if uncompressed_length == 0 {
            // protocol spec 2.2:
            // An uncompressed length of 0 signals that the compressed payload should be used as-is
            // and not decompressed.
            let payload = buffer[COMPRESSED_FRAME_HEADER_LENGTH..compressed_payload_end].into();
            *buffer = buffer.split_off(frame_end);

            return Ok(Some((self_contained, payload)));
        }

        decompress(
            &buffer[COMPRESSED_FRAME_HEADER_LENGTH..compressed_payload_end],
            uncompressed_length,
        )
        .map_err(|error| CompressionError::Lz4(io::Error::other(error)).into())
        .map(|payload| {
            *buffer = buffer.split_off(frame_end);
            Some((self_contained, payload))
        })
    }
}

/// Post-V5 decoder with support for envelope frames with CRC checksum.
#[derive(Clone, Debug, Default)]
pub struct UncompressedFrameDecoder {
    inner_decoder: GenericFrameDecoder,
}

impl FrameDecoder for UncompressedFrameDecoder {
    //noinspection DuplicatedCode
    #[inline]
    fn consume(&mut self, data: &mut Vec<u8>, _compression: Compression) -> Result<Vec<Envelope>> {
        self.inner_decoder.consume(data, Self::try_decode_frame)
    }
}

impl UncompressedFrameDecoder {
    fn try_decode_frame(buffer: &mut Vec<u8>) -> Result<Option<(bool, Vec<u8>)>> {
        let buffer_len = buffer.len();
        if buffer_len < UNCOMPRESSED_FRAME_HEADER_LENGTH {
            return Ok(None);
        }

        let header = if buffer_len >= 8 {
            i64::from_le_bytes(buffer[..8].try_into().unwrap()) & 0xffffffffffff
        } else {
            let mut header = 0;
            for (i, byte) in buffer[..UNCOMPRESSED_FRAME_HEADER_LENGTH]
                .iter()
                .enumerate()
            {
                header |= (*byte as i64) << (8 * i as i64);
            }

            header
        };

        let header_crc24 = ((header >> 24) & 0xffffff) as i32;
        let computed_crc = crc24(&header.to_le_bytes()[..3]);

        if header_crc24 != computed_crc {
            return Err(create_header_crc_mismatch_error(computed_crc, header_crc24));
        }

        let payload_length = (header & 0x1ffff) as usize;
        let payload_end = UNCOMPRESSED_FRAME_HEADER_LENGTH + payload_length;

        let frame_end = payload_end + FRAME_TRAILER_LENGTH;
        if buffer_len < frame_end {
            return Ok(None);
        }

        let payload_crc32 = u32::from_le_bytes(buffer[payload_end..frame_end].try_into().unwrap());

        let computed_crc = crc32(&buffer[UNCOMPRESSED_FRAME_HEADER_LENGTH..payload_end]);
        if payload_crc32 != computed_crc {
            return Err(create_payload_crc_mismatch_error(
                computed_crc,
                payload_crc32,
            ));
        }

        let self_contained = (header & (1 << 17)) != 0;

        let payload = buffer[UNCOMPRESSED_FRAME_HEADER_LENGTH..payload_end].into();
        *buffer = buffer.split_off(frame_end);

        Ok(Some((self_contained, payload)))
    }
}

#[derive(Clone, Debug)]
struct GenericFrameDecoder {
    frame_buffer: Vec<u8>,
    payload_buffer: Vec<u8>,
    expected_payload_len: Option<usize>,
}

impl Default for GenericFrameDecoder {
    fn default() -> Self {
        Self {
            frame_buffer: Vec::with_capacity(MAX_FRAME_SIZE),
            payload_buffer: Vec::with_capacity(PAYLOAD_SIZE_LIMIT * 2),
            expected_payload_len: None,
        }
    }
}

impl GenericFrameDecoder {
    fn extract_non_self_contained_envelopes(&mut self) -> Result<Vec<Envelope>> {
        if let Some(expected_payload_len) = self.expected_payload_len {
            // The Cassandra wire format encodes the body length in bytes 5..9
            // of the envelope header (after version/flags/stream/opcode). The
            // FULL envelope on the wire is therefore ENVELOPE_HEADER_LEN bytes
            // of header plus expected_payload_len bytes of body, so the buffer
            // must contain at least that many bytes before we can decode it.
            // Without this header offset we would attempt to decode while the
            // body was still partial, lose the partial data on the buffer
            // truncation below, and mis-frame the next envelope.
            let total_envelope_len = ENVELOPE_HEADER_LEN + expected_payload_len;
            if self.payload_buffer.len() < total_envelope_len {
                return Ok(vec![]);
            }

            // Use extract_envelopes directly so we know exactly how many bytes
            // got consumed. drain(..consumed) preserves any trailing bytes
            // that may belong to the next envelope - they could legitimately
            // be there if a producer packed bytes from envelope N+1 into the
            // tail of the non-self-contained sequence for envelope N. The
            // previous code simply called clear() and silently lost them.
            let (consumed, envelopes) = extract_envelopes(&self.payload_buffer, Compression::None)?;
            self.payload_buffer.drain(..consumed);

            // Reset envelope-tracking state so the next call re-parses the
            // body length from whatever envelope header remains at the start
            // of the buffer (or waits for one if the buffer is empty / a
            // partial header). Without this reset the next sequence would be
            // gated against the previous envelope's length.
            self.expected_payload_len = None;
            return Ok(envelopes);
        }

        if let Some(expected_payload_len) = self.extract_expected_payload_len() {
            self.expected_payload_len = Some(expected_payload_len);
            self.extract_non_self_contained_envelopes()
        } else {
            Ok(vec![])
        }
    }

    fn extract_expected_payload_len(&self) -> Option<usize> {
        if self.payload_buffer.len() < ENVELOPE_HEADER_LEN {
            return None;
        }

        Some(i32::from_be_bytes(self.payload_buffer[5..9].try_into().unwrap()) as usize)
    }

    fn handle_frame(
        &mut self,
        envelopes: &mut Vec<Envelope>,
        self_contained: bool,
        frame: &mut Vec<u8>,
    ) -> Result<()> {
        if self_contained {
            if !self.payload_buffer.is_empty() {
                return Err(create_unexpected_self_contained_error());
            }

            envelopes.append(&mut try_decode_envelopes_without_spare_data(frame)?);
        } else {
            self.payload_buffer.append(frame);
            envelopes.append(&mut self.extract_non_self_contained_envelopes()?);
        }

        Ok(())
    }

    fn consume(
        &mut self,
        data: &mut Vec<u8>,
        try_decode_frame: impl Fn(&mut Vec<u8>) -> Result<Option<(bool, Vec<u8>)>>,
    ) -> Result<Vec<Envelope>> {
        let mut envelopes = vec![];

        if self.frame_buffer.is_empty() {
            // optimistic case
            while !data.is_empty() {
                if let Some((self_contained, mut frame)) = try_decode_frame(data)? {
                    self.handle_frame(&mut envelopes, self_contained, &mut frame)?;
                } else {
                    // we have some data, but not a full frame yet
                    self.frame_buffer.append(data);
                    break;
                }
            }
        } else {
            self.frame_buffer.append(data);

            while !self.frame_buffer.is_empty() {
                if let Some((self_contained, mut frame)) = try_decode_frame(&mut self.frame_buffer)?
                {
                    self.handle_frame(&mut envelopes, self_contained, &mut frame)?;
                } else {
                    break;
                }
            }
        }

        Ok(envelopes)
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::frame::frame_encoder::{FrameEncoder, UncompressedFrameEncoder};
    use crate::frame::{Direction, Envelope, Flags, Opcode, Version};

    // Build a body of `size` bytes filled with the supplied byte. We pick the
    // body size to be larger than PAYLOAD_SIZE_LIMIT so the encoder is forced
    // to emit non-self-contained frames.
    fn make_envelope(stream_id: i16, fill: u8, body_size: usize) -> Vec<u8> {
        Envelope {
            version: Version::V5,
            direction: Direction::Request,
            flags: Flags::empty(),
            opcode: Opcode::Query,
            stream_id,
            body: vec![fill; body_size],
            tracing_id: None,
            warnings: vec![],
        }
        .encode_with(Compression::None)
        .unwrap()
    }

    // Encode one envelope (which is too large to fit in a single frame) as a
    // sequence of non-self-contained frames. Each frame has its own header and
    // CRC trailer so we can simply concatenate them on the wire.
    fn encode_as_non_self_contained(envelope: &[u8]) -> Vec<u8> {
        let mut encoder = UncompressedFrameEncoder::default();
        let mut wire = vec![];
        let mut start = 0;
        while start < envelope.len() {
            let (consumed, frame) = encoder.finalize_non_self_contained(&envelope[start..]);
            wire.extend_from_slice(frame);
            start += consumed;
            encoder.reset();
        }
        wire
    }

    #[test]
    fn decoder_recovers_two_consecutive_non_self_contained_envelopes() {
        // Use a body just over PAYLOAD_SIZE_LIMIT so each envelope spans two
        // frames; the second envelope is deliberately a different (smaller)
        // size to expose any stale `expected_payload_len` carryover.
        let envelope_a = make_envelope(1, 0xAA, PAYLOAD_SIZE_LIMIT + 100);
        let envelope_b = make_envelope(2, 0xBB, PAYLOAD_SIZE_LIMIT + 50);

        let mut wire = encode_as_non_self_contained(&envelope_a);
        wire.extend_from_slice(&encode_as_non_self_contained(&envelope_b));

        let mut decoder = UncompressedFrameDecoder::default();
        let envelopes = decoder
            .consume(&mut wire, Compression::None)
            .expect("decoder must accept two consecutive non-self-contained envelopes");

        // we expect to recover both envelopes intact, in order
        assert_eq!(envelopes.len(), 2, "should decode both envelopes");
        assert_eq!(envelopes[0].stream_id, 1);
        assert_eq!(envelopes[0].body, vec![0xAA; PAYLOAD_SIZE_LIMIT + 100]);
        assert_eq!(envelopes[1].stream_id, 2);
        assert_eq!(envelopes[1].body, vec![0xBB; PAYLOAD_SIZE_LIMIT + 50]);
    }

    // The reviewer pointed out a defensive gap: when payload_buffer holds a
    // complete envelope plus the start of the next envelope (because a
    // hypothetical producer packed bytes across envelope boundaries inside
    // non-self-contained frames), the previous code called clear() on the
    // buffer after decoding the first envelope, losing the trailing bytes
    // that begin the next envelope.
    //
    // We construct that exact scenario by hand-packing one non-self-contained
    // frame whose payload is `envelope_a + envelope_b[..partial]`, followed
    // by another non-self-contained frame carrying `envelope_b[partial..]`.
    // A correct decoder must reconstruct both envelopes; a buggy one drops
    // envelope_b's prefix on `clear()` and then fails to parse the second
    // envelope from a misaligned start.
    #[test]
    fn decoder_preserves_trailing_bytes_across_non_self_contained_frames() {
        let envelope_a = make_envelope(1, 0xAA, 100);
        let envelope_b = make_envelope(2, 0xBB, 200);

        // Frame 1 carries envelope_a in full PLUS the first 100 bytes of
        // envelope_b. Both fit comfortably under PAYLOAD_SIZE_LIMIT, so
        // finalize_non_self_contained packs them into a single frame.
        let half_b = 100usize;
        let mut packed = envelope_a.clone();
        packed.extend_from_slice(&envelope_b[..half_b]);

        let mut encoder = UncompressedFrameEncoder::default();
        let (consumed, frame1_slice) = encoder.finalize_non_self_contained(&packed);
        assert_eq!(
            consumed,
            packed.len(),
            "test setup: whole packed slice must fit"
        );
        let frame1: Vec<u8> = frame1_slice.to_vec();
        encoder.reset();

        // Frame 2 carries the remaining bytes of envelope_b.
        let (_, frame2_slice) = encoder.finalize_non_self_contained(&envelope_b[half_b..]);
        let frame2: Vec<u8> = frame2_slice.to_vec();

        let mut wire = frame1;
        wire.extend_from_slice(&frame2);

        let mut decoder = UncompressedFrameDecoder::default();
        let envelopes = decoder
            .consume(&mut wire, Compression::None)
            .expect("decoder must accept the cross-boundary packed frames");

        assert_eq!(envelopes.len(), 2, "both envelopes must be recovered");
        assert_eq!(envelopes[0].stream_id, 1);
        assert_eq!(envelopes[0].body, vec![0xAA; 100]);
        assert_eq!(envelopes[1].stream_id, 2);
        assert_eq!(envelopes[1].body, vec![0xBB; 200]);
    }
}


================================================
FILE: cassandra-protocol/src/frame/frame_encoder.rs
================================================
use crate::crc::{crc24, crc32};
use crate::frame::{
    COMPRESSED_FRAME_HEADER_LENGTH, FRAME_TRAILER_LENGTH, PAYLOAD_SIZE_LIMIT,
    UNCOMPRESSED_FRAME_HEADER_LENGTH,
};
use lz4_flex::block::get_maximum_output_size;
use lz4_flex::{compress, compress_into};

#[inline]
fn put3b(buffer: &mut [u8], value: i32) {
    let value = value.to_le_bytes();
    buffer[0] = value[0];
    buffer[1] = value[1];
    buffer[2] = value[2];
}

#[inline]
fn add_trailer(buffer: &mut Vec<u8>, payload_start: usize) {
    buffer.reserve(4);

    let crc = crc32(&buffer[payload_start..]).to_le_bytes();

    buffer.push(crc[0]);
    buffer.push(crc[1]);
    buffer.push(crc[2]);
    buffer.push(crc[3]);
}

/// An encoder for frames. Since protocol *v5*, frames became "envelopes" and a frame now can contain
/// multiple complete envelopes (self-contained frame) or a part of one bigger envelope.
///
/// Encoders are stateful and can either:
/// 1. Have multiple self-contained envelopes added.
/// 2. Have a single non self-contained envelope added.
///
/// In either case, the encoder is assumed to have the buffer ready to accept envelopes before
/// adding the first one or after calling [`reset_buffer`]. At some point, the frame can become
/// finalized (which is the only possible case when adding a non self-contained envelope) and the
/// returned buffer is assumed to be immutable and ready to be sent.  
pub trait FrameEncoder {
    /// Determines if payload of given size can fit in current frame buffer.
    fn can_fit(&self, len: usize) -> bool;

    /// Resets the internal state and prepares it for encoding envelopes.
    fn reset(&mut self);

    /// Adds a self-contained envelope to current frame.
    fn add_envelope(&mut self, envelope: Vec<u8>);

    /// Finalizes a self-contained encoded frame in the buffer.
    fn finalize_self_contained(&mut self) -> &[u8];

    /// Appends a large envelope and finalizes non self-contained encoded frame in the buffer.
    /// Copies as much envelope data as possible and returns new envelope buffer start.
    fn finalize_non_self_contained(&mut self, envelope: &[u8]) -> (usize, &[u8]);

    /// Checks if current frame contains any envelopes.
    fn has_envelopes(&self) -> bool;
}

/// Pre-V5 frame encoder which simply encodes one envelope directly in the buffer.
#[derive(Clone, Debug, Default)]
pub struct LegacyFrameEncoder {
    buffer: Vec<u8>,
}

impl FrameEncoder for LegacyFrameEncoder {
    #[inline]
    fn can_fit(&self, _len: usize) -> bool {
        // we support only one envelope per frame
        self.buffer.is_empty()
    }

    #[inline]
    fn reset(&mut self) {
        self.buffer.clear();
    }

    #[inline]
    fn add_envelope(&mut self, envelope: Vec<u8>) {
        self.buffer = envelope;
    }

    #[inline]
    fn finalize_self_contained(&mut self) -> &[u8] {
        &self.buffer
    }

    #[inline]
    fn finalize_non_self_contained(&mut self, envelope: &[u8]) -> (usize, &[u8]) {
        // attempting to finalize a non self-contained frame via the legacy encoder - while this
        // will work, the legacy encoder doesn't distinguish such frames and all are considered
        // self-contained

        self.buffer.clear();
        self.buffer.extend_from_slice(envelope);

        (envelope.len(), &self.buffer)
    }

    #[inline]
    fn has_envelopes(&self) -> bool {
        !self.buffer.is_empty()
    }
}

/// Post-V5 encoder with support for envelope frames with CRC checksum.
#[derive(Clone, Debug)]
pub struct UncompressedFrameEncoder {
    buffer: Vec<u8>,
}

impl FrameEncoder for UncompressedFrameEncoder {
    #[inline]
    fn can_fit(&self, len: usize) -> bool {
        (self.buffer.len() - UNCOMPRESSED_FRAME_HEADER_LENGTH).saturating_add(len)
            < PAYLOAD_SIZE_LIMIT
    }

    #[inline]
    fn reset(&mut self) {
        self.buffer.truncate(UNCOMPRESSED_FRAME_HEADER_LENGTH);
    }

    #[inline]
    fn add_envelope(&mut self, mut envelope: Vec<u8>) {
        self.buffer.append(&mut envelope);
    }

    fn finalize_self_contained(&mut self) -> &[u8] {
        self.write_header(true);
        add_trailer(&mut self.buffer, UNCOMPRESSED_FRAME_HEADER_LENGTH);

        &self.buffer
    }

    fn finalize_non_self_contained(&mut self, envelope: &[u8]) -> (usize, &[u8]) {
        let max_size = envelope.len().min(PAYLOAD_SIZE_LIMIT - 1);

        self.buffer.extend_from_slice(&envelope[..max_size]);
        self.buffer.reserve(FRAME_TRAILER_LENGTH);

        self.write_header(false);
        add_trailer(&mut self.buffer, UNCOMPRESSED_FRAME_HEADER_LENGTH);

        (max_size, &self.buffer)
    }

    #[inline]
    fn has_envelopes(&self) -> bool {
        self.buffer.len() > UNCOMPRESSED_FRAME_HEADER_LENGTH
    }
}

impl Default for UncompressedFrameEncoder {
    fn default() -> Self {
        let buffer = vec![0; UNCOMPRESSED_FRAME_HEADER_LENGTH];
        Self { buffer }
    }
}

impl UncompressedFrameEncoder {
    fn write_header(&mut self, self_contained: bool) {
        let len = self.buffer.len();
        debug_assert!(
            len < (PAYLOAD_SIZE_LIMIT + UNCOMPRESSED_FRAME_HEADER_LENGTH),
            "len: {} max: {}",
            len,
            PAYLOAD_SIZE_LIMIT + UNCOMPRESSED_FRAME_HEADER_LENGTH
        );

        let mut len = (len - UNCOMPRESSED_FRAME_HEADER_LENGTH) as u64;
        if self_contained {
            len |= 1 << 17;
        }

        put3b(self.buffer.as_mut_slice(), len as i32);
        put3b(&mut self.buffer[3..], crc24(&len.to_le_bytes()[..3]));
    }
}

/// Post-V5 Lz4 encoder with support for envelope frames with CRC checksum.
#[derive(Clone, Debug)]
pub struct Lz4FrameEncoder {
    buffer: Vec<u8>,
}

impl FrameEncoder for Lz4FrameEncoder {
    #[inline]
    fn can_fit(&self, len: usize) -> bool {
        // we don't know the whole compressed payload size, so we need to be conservative and expect
        // the worst case
        get_maximum_output_size(
            (self.buffer.len() - COMPRESSED_FRAME_HEADER_LENGTH).saturating_add(len),
        ) < PAYLOAD_SIZE_LIMIT
    }

    #[inline]
    fn reset(&mut self) {
        self.buffer.truncate(COMPRESSED_FRAME_HEADER_LENGTH);
    }

    #[inline]
    fn add_envelope(&mut self, mut envelope: Vec<u8>) {
        self.buffer.append(&mut envelope);
    }

    fn finalize_self_contained(&mut self) -> &[u8] {
        let uncompressed_size = self.buffer.len() - COMPRESSED_FRAME_HEADER_LENGTH;
        let mut compressed_payload = compress(&self.buffer[COMPRESSED_FRAME_HEADER_LENGTH..]);

        self.buffer.truncate(COMPRESSED_FRAME_HEADER_LENGTH);
        self.buffer.append(&mut compressed_payload);

        self.write_header(uncompressed_size, true);
        add_trailer(&mut self.buffer, COMPRESSED_FRAME_HEADER_LENGTH);

        &self.buffer
    }

    fn finalize_non_self_contained(&mut self, envelope: &[u8]) -> (usize, &[u8]) {
        let mut uncompressed_size = envelope.len().min(PAYLOAD_SIZE_LIMIT - 1);
        let offset = uncompressed_size;

        self.buffer.resize(
            get_maximum_output_size(uncompressed_size)
                + COMPRESSED_FRAME_HEADER_LENGTH
                + FRAME_TRAILER_LENGTH, // add space for trailer, so we don't allocate later
            0,
        );

        let mut compressed_size = compress_into(
            &envelope[..uncompressed_size],
            &mut self.buffer[COMPRESSED_FRAME_HEADER_LENGTH..],
        )
        .unwrap(); // we can safely unwrap, since we have at least the amount of space needed

        if compressed_size >= PAYLOAD_SIZE_LIMIT {
            // compressed size can exceed source size, therefore can exceed max payload size
            // Java driver simply ignores compression at this point, so ¯\_(ツ)_/¯
            self.buffer[COMPRESSED_FRAME_HEADER_LENGTH
                ..(COMPRESSED_FRAME_HEADER_LENGTH + uncompressed_size)]
                .copy_from_slice(&envelope[..uncompressed_size]);

            compressed_size = uncompressed_size;
            uncompressed_size = 0; // compressed size of 0 means no compression
        }

        self.buffer
            .truncate(COMPRESSED_FRAME_HEADER_LENGTH + compressed_size);

        self.write_header(uncompressed_size, false);
        add_trailer(&mut self.buffer, COMPRESSED_FRAME_HEADER_LENGTH);

        (offset, &self.buffer)
    }

    #[inline]
    fn has_envelopes(&self) -> bool {
        self.buffer.len() > COMPRESSED_FRAME_HEADER_LENGTH
    }
}

impl Default for Lz4FrameEncoder {
    fn default() -> Self {
        let buffer = vec![0; COMPRESSED_FRAME_HEADER_LENGTH];
        Self { buffer }
    }
}

impl Lz4FrameEncoder {
    fn write_header(&mut self, uncompressed_size: usize, self_contained: bool) {
        let len = self.buffer.len();
        debug_assert!(len < (PAYLOAD_SIZE_LIMIT + COMPRESSED_FRAME_HEADER_LENGTH));

        let mut header =
            (len - COMPRESSED_FRAME_HEADER_LENGTH) as u64 | ((uncompressed_size as u64) << 17);

        if self_contained {
            header |= 1 << 34;
        }

        let crc = crc24(&header.to_le_bytes()[..5]) as u64;

        let header = header | (crc << 40);
        self.buffer[..8].copy_from_slice(&header.to_le_bytes());
    }
}


================================================
FILE: cassandra-protocol/src/frame/message_auth_challenge.rs
================================================
use super::Serialize;
use crate::error;
use crate::frame::{FromCursor, Version};
use crate::types::CBytes;
use std::io::Cursor;

/// Server authentication challenge.
#[derive(Debug, PartialEq, Ord, PartialOrd, Eq, Hash, Clone)]
pub struct BodyResAuthChallenge {
    pub data: CBytes,
}

impl Serialize for BodyResAuthChallenge {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        self.data.serialize(cursor, version);
    }
}

impl FromCursor for BodyResAuthChallenge {
    fn from_cursor(
        cursor: &mut Cursor<&[u8]>,
        version: Version,
    ) -> error::Result<BodyResAuthChallenge> {
        CBytes::from_cursor(cursor, version).map(|data| BodyResAuthChallenge { data })
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::frame::traits::FromCursor;
    use std::io::Cursor;

    #[test]
    fn body_res_auth_challenge_from_cursor() {
        let bytes = &[0, 0, 0, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
        let expected = BodyResAuthChallenge {
            data: CBytes::new(vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9]),
        };

        {
            let mut cursor: Cursor<&[u8]> = Cursor::new(bytes);
            let body = BodyResAuthChallenge::from_cursor(&mut cursor, Version::V4).unwrap();
            assert_eq!(
                body.data.into_bytes().unwrap(),
                vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
            );
        }

        {
            let mut buffer = Vec::new();
            let mut cursor = Cursor::new(&mut buffer);
            expected.serialize(&mut cursor, Version::V4);
            assert_eq!(buffer, bytes);
        }
    }
}


================================================
FILE: cassandra-protocol/src/frame/message_auth_response.rs
================================================
use crate::error;
use crate::frame::{Direction, Envelope, Flags, FromCursor, Opcode, Serialize, Version};
use crate::types::CBytes;
use derive_more::Constructor;
use std::io::Cursor;

#[derive(Debug, Constructor, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub struct BodyReqAuthResponse {
    pub data: CBytes,
}

impl Serialize for BodyReqAuthResponse {
    #[inline]
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        self.data.serialize(cursor, version);
    }
}

impl FromCursor for BodyReqAuthResponse {
    fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::Result<Self> {
        CBytes::from_cursor(cursor, version).map(BodyReqAuthResponse::new)
    }
}

impl Envelope {
    /// Creates new envelope of type `AuthResponse`.
    pub fn new_req_auth_response(token_bytes: CBytes, version: Version) -> Envelope {
        let direction = Direction::Request;
        let opcode = Opcode::AuthResponse;
        let body = BodyReqAuthResponse::new(token_bytes);

        Envelope::new(
            version,
            direction,
            Flags::empty(),
            opcode,
            0,
            body.serialize_to_vec(version),
            None,
            vec![],
        )
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::types::CBytes;

    #[test]
    fn body_req_auth_response() {
        let bytes = CBytes::new(vec![1, 2, 3]);
        let body = BodyReqAuthResponse::new(bytes);
        assert_eq!(
            body.serialize_to_vec(Version::V4),
            vec![0, 0, 0, 3, 1, 2, 3]
        );
    }

    #[test]
    fn frame_body_req_auth_response() {
        let bytes = vec![1, 2, 3];
        let frame = Envelope::new_req_auth_response(CBytes::new(bytes), Version::V4);

        assert_eq!(frame.version, Version::V4);
        assert_eq!(frame.opcode, Opcode::AuthResponse);
        assert_eq!(frame.body, &[0, 0, 0, 3, 1, 2, 3]);
        assert_eq!(frame.tracing_id, None);
        assert!(frame.warnings.is_empty());
    }
}


================================================
FILE: cassandra-protocol/src/frame/message_auth_success.rs
================================================
use super::Serialize;
use crate::error;
use crate::frame::{FromCursor, Version};
use crate::types::CBytes;
use std::io::Cursor;

/// `BodyReqAuthSuccess` is a envelope that represents a successful authentication response.
#[derive(Debug, PartialEq, Ord, PartialOrd, Eq, Hash, Clone)]
pub struct BodyReqAuthSuccess {
    pub data: CBytes,
}

impl Serialize for BodyReqAuthSuccess {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        self.data.serialize(cursor, version);
    }
}

impl FromCursor for BodyReqAuthSuccess {
    fn from_cursor(
        cursor: &mut Cursor<&[u8]>,
        version: Version,
    ) -> error::Result<BodyReqAuthSuccess> {
        CBytes::from_cursor(cursor, version).map(|data| BodyReqAuthSuccess { data })
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::frame::traits::FromCursor;
    use std::io::Cursor;

    #[test]
    fn body_req_auth_success() {
        let bytes = &[0, 0, 0, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
        let expected = BodyReqAuthSuccess {
            data: CBytes::new(vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9]),
        };

        {
            let mut cursor: Cursor<&[u8]> = Cursor::new(bytes);
            let body = BodyReqAuthSuccess::from_cursor(&mut cursor, Version::V4).unwrap();
            assert_eq!(
                body.data.into_bytes().unwrap(),
                vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
            );
        }

        {
            let mut buffer = Vec::new();
            let mut cursor = Cursor::new(&mut buffer);
            expected.serialize(&mut cursor, Version::V4);
            assert_eq!(buffer, bytes);
        }
    }
}


================================================
FILE: cassandra-protocol/src/frame/message_authenticate.rs
================================================
use super::Serialize;
use crate::error;
use crate::frame::{FromCursor, Version};
use crate::types::{from_cursor_str, serialize_str};
use std::io::Cursor;

/// A server authentication challenge.
#[derive(Debug, PartialEq, Ord, PartialOrd, Eq, Hash, Clone)]
pub struct BodyResAuthenticate {
    pub data: String,
}

impl Serialize for BodyResAuthenticate {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        serialize_str(cursor, &self.data, version);
    }
}

impl FromCursor for BodyResAuthenticate {
    fn from_cursor(
        cursor: &mut Cursor<&[u8]>,
        _version: Version,
    ) -> error::Result<BodyResAuthenticate> {
        Ok(BodyResAuthenticate {
            data: from_cursor_str(cursor)?.to_string(),
        })
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::frame::traits::FromCursor;
    use crate::frame::Version;
    use std::io::Cursor;

    #[test]
    fn body_res_authenticate() {
        // string "abcde"
        let bytes = [0, 5, 97, 98, 99, 100, 101];
        let expected = BodyResAuthenticate {
            data: "abcde".into(),
        };

        {
            let mut cursor: Cursor<&[u8]> = Cursor::new(&bytes);
            let auth = BodyResAuthenticate::from_cursor(&mut cursor, Version::V4).unwrap();
            assert_eq!(auth, expected);
        }

        {
            let mut buffer = Vec::new();
            let mut cursor = Cursor::new(&mut buffer);
            expected.serialize(&mut cursor, Version::V4);
            assert_eq!(buffer, bytes);
        }
    }
}


================================================
FILE: cassandra-protocol/src/frame/message_batch.rs
================================================
use crate::consistency::Consistency;
use crate::frame::{Direction, Envelope, Flags, FromCursor, Opcode, Serialize, Version};
use crate::query::QueryFlags;
use crate::query::QueryValues;
use crate::types::value::Value;
use crate::types::{
    from_cursor_str, from_cursor_str_long, serialize_str, serialize_str_long, CBytesShort, CInt,
    CIntShort, CLong,
};
use crate::{error, Error};
use derive_more::{Constructor, Display};
use std::convert::{TryFrom, TryInto};
use std::io::{Cursor, Read};

#[derive(Debug, Clone, Constructor, PartialEq, Eq)]
pub struct BodyReqBatch {
    pub batch_type: BatchType,
    pub queries: Vec<BatchQuery>,
    pub consistency: Consistency,
    pub serial_consistency: Option<Consistency>,
    pub timestamp: Option<CLong>,
    pub keyspace: Option<String>,
    pub now_in_seconds: Option<CInt>,
}

impl Serialize for BodyReqBatch {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        let batch_type = u8::from(self.batch_type);
        batch_type.serialize(cursor, version);

        let len = self.queries.len() as CIntShort;
        len.serialize(cursor, version);

        for query in &self.queries {
            query.serialize(cursor, version);
        }

        let consistency: CIntShort = self.consistency.into();
        consistency.serialize(cursor, version);

        let mut flags = QueryFlags::empty();
        if self.serial_consistency.is_some() {
            flags.insert(QueryFlags::WITH_SERIAL_CONSISTENCY)
        }

        if self.timestamp.is_some() {
            flags.insert(QueryFlags::WITH_DEFAULT_TIMESTAMP)
        }

        if self.keyspace.is_some() {
            flags.insert(QueryFlags::WITH_KEYSPACE)
        }

        if self.now_in_seconds.is_some() {
            flags.insert(QueryFlags::WITH_NOW_IN_SECONDS)
        }

        flags.serialize(cursor, version);

        if let Some(serial_consistency) = self.serial_consistency {
            let serial_consistency: CIntShort = serial_consistency.into();
            serial_consistency.serialize(cursor, version);
        }

        if let Some(timestamp) = self.timestamp {
            timestamp.serialize(cursor, version);
        }

        if let Some(keyspace) = &self.keyspace {
            serialize_str(cursor, keyspace.as_str(), version);
        }

        if let Some(now_in_seconds) = self.now_in_seconds {
            now_in_seconds.serialize(cursor, version);
        }
    }
}

impl FromCursor for BodyReqBatch {
    fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::Result<Self> {
        let mut batch_type = [0];
        cursor.read_exact(&mut batch_type)?;

        let batch_type = BatchType::try_from(batch_type[0])?;
        let len = CIntShort::from_cursor(cursor, version)?;

        let mut queries = Vec::with_capacity(len as usize);
        for _ in 0..len {
            queries.push(BatchQuery::from_cursor(cursor, version)?);
        }

        let consistency = CIntShort::from_cursor(cursor, version).and_then(TryInto::try_into)?;
        let query_flags = QueryFlags::from_cursor(cursor, version)?;

        let serial_consistency = if query_flags.contains(QueryFlags::WITH_SERIAL_CONSISTENCY) {
            Some(CIntShort::from_cursor(cursor, version).and_then(TryInto::try_into)?)
        } else {
            None
        };

        let timestamp = if query_flags.contains(QueryFlags::WITH_DEFAULT_TIMESTAMP) {
            Some(CLong::from_cursor(cursor, version)?)
        } else {
            None
        };

        let keyspace = if query_flags.contains(QueryFlags::WITH_KEYSPACE) {
            Some(from_cursor_str(cursor).map(|keyspace| keyspace.to_string())?)
        } else {
            None
        };

        let now_in_seconds = if query_flags.contains(QueryFlags::WITH_NOW_IN_SECONDS) {
            Some(CInt::from_cursor(cursor, version)?)
        } else {
            None
        };

        Ok(BodyReqBatch::new(
            batch_type,
            queries,
            consistency,
            serial_consistency,
            timestamp,
            keyspace,
            now_in_seconds,
        ))
    }
}

/// Batch type
#[derive(Debug, Clone, Copy, PartialEq, Ord, PartialOrd, Eq, Hash, Display)]
#[non_exhaustive]
pub enum BatchType {
    /// The batch will be "logged". This is equivalent to a
    /// normal CQL3 batch statement.
    Logged,
    /// The batch will be "unlogged".
    Unlogged,
    /// The batch will be a "counter" batch (and non-counter
    /// statements will be rejected).
    Counter,
}

impl TryFrom<u8> for BatchType {
    type Error = Error;

    fn try_from(value: u8) -> Result<Self, Self::Error> {
        match value {
            0 => Ok(BatchType::Logged),
            1 => Ok(BatchType::Unlogged),
            2 => Ok(BatchType::Counter),
            _ => Err(Error::General(format!("Unknown batch type: {value}"))),
        }
    }
}

impl From<BatchType> for u8 {
    fn from(value: BatchType) -> Self {
        match value {
            BatchType::Logged => 0,
            BatchType::Unlogged => 1,
            BatchType::Counter => 2,
        }
    }
}

/// Contains either an id of a prepared query or CQL string.
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub enum BatchQuerySubj {
    PreparedId(CBytesShort),
    QueryString(String),
}

/// The structure that represents a query to be batched.
#[derive(Debug, Clone, Constructor, PartialEq, Eq)]
pub struct BatchQuery {
    /// Contains either id of a prepared query or a query itself.
    pub subject: BatchQuerySubj,
    /// **Important note:** QueryValues::NamedValues does not work and should not be
    /// used for batches. It is specified in a way that makes it impossible for the server
    /// to implement. This will be fixed in a future version of the native
    /// protocol. See <https://issues.apache.org/jira/browse/CASSANDRA-10246> for
    /// more details
    pub values: QueryValues,
}

impl Serialize for BatchQuery {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        match &self.subject {
            BatchQuerySubj::PreparedId(id) => {
                1u8.serialize(cursor, version);
                id.serialize(cursor, version);
            }
            BatchQuerySubj::QueryString(s) => {
                0u8.serialize(cursor, version);
                serialize_str_long(cursor, s, version);
            }
        }

        let len = self.values.len() as CIntShort;
        len.serialize(cursor, version);

        self.values.serialize(cursor, version);
    }
}

impl FromCursor for BatchQuery {
    fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::Result<Self> {
        let mut is_prepared = [0];
        cursor.read_exact(&mut is_prepared)?;

        let is_prepared = is_prepared[0] != 0;

        let subject = if is_prepared {
            BatchQuerySubj::PreparedId(CBytesShort::from_cursor(cursor, version)?)
        } else {
            BatchQuerySubj::QueryString(from_cursor_str_long(cursor).map(Into::into)?)
        };

        let len = CIntShort::from_cursor(cursor, version)?;

        // assuming names are not present due to
        // https://issues.apache.org/jira/browse/CASSANDRA-10246
        let mut values = Vec::with_capacity(len as usize);
        for _ in 0..len {
            values.push(Value::from_cursor(cursor, version)?);
        }

        Ok(BatchQuery::new(subject, QueryValues::SimpleValues(values)))
    }
}

impl Envelope {
    pub fn new_req_batch(query: BodyReqBatch, flags: Flags, version: Version) -> Envelope {
        let direction = Direction::Request;
        let opcode = Opcode::Batch;

        Envelope::new(
            version,
            direction,
            flags,
            opcode,
            0,
            query.serialize_to_vec(version),
            None,
            vec![],
        )
    }
}

#[cfg(test)]
mod tests {
    use crate::consistency::Consistency;
    use crate::frame::message_batch::{BatchQuery, BatchQuerySubj, BatchType, BodyReqBatch};
    use crate::frame::traits::Serialize;
    use crate::frame::{FromCursor, Version};
    use crate::query::QueryValues;
    use crate::types::prelude::Value;
    use std::io::Cursor;

    #[test]
    fn should_deserialize_query() {
        let data = [0, 0, 0, 0, 1, 65, 0, 1, 0xff, 0xff, 0xff, 0xfe];
        let mut cursor = Cursor::new(data.as_slice());

        let query = BatchQuery::from_cursor(&mut cursor, Version::V4).unwrap();
        assert_eq!(query.subject, BatchQuerySubj::QueryString("A".into()));
        assert_eq!(query.values, QueryValues::SimpleValues(vec![Value::NotSet]));
    }

    #[test]
    fn should_deserialize_body() {
        let data = [0, 0, 0, 0, 0, 0x10 | 0x20, 0, 1, 1, 2, 3, 4, 5, 6, 7, 8];
        let mut cursor = Cursor::new(data.as_slice());

        let body = BodyReqBatch::from_cursor(&mut cursor, Version::V4).unwrap();
        assert_eq!(body.batch_type, BatchType::Logged);
        assert!(body.queries.is_empty());
        assert_eq!(body.consistency, Consistency::Any);
        assert_eq!(body.serial_consistency, Some(Consistency::One));
        assert_eq!(body.timestamp, Some(0x0102030405060708));
    }

    #[test]
    fn should_support_keyspace() {
        let keyspace = "abc";
        let body = BodyReqBatch::new(
            BatchType::Logged,
            vec![],
            Consistency::Any,
            None,
            None,
            Some(keyspace.into()),
            None,
        );

        let data = body.serialize_to_vec(Version::V5);
        let body =
            BodyReqBatch::from_cursor(&mut Cursor::new(data.as_slice()), Version::V5).unwrap();
        assert_eq!(body.keyspace, Some(keyspace.to_string()));
    }

    #[test]
    fn should_support_now_in_seconds() {
        let now_in_seconds = 4;
        let body = BodyReqBatch::new(
            BatchType::Logged,
            vec![],
            Consistency::Any,
            None,
            None,
            None,
            Some(now_in_seconds),
        );

        let data = body.serialize_to_vec(Version::V5);
        let body =
            BodyReqBatch::from_cursor(&mut Cursor::new(data.as_slice()), Version::V5).unwrap();
        assert_eq!(body.now_in_seconds, Some(now_in_seconds));
    }
}


================================================
FILE: cassandra-protocol/src/frame/message_error.rs
================================================
use super::Serialize;
use crate::consistency::Consistency;
use crate::frame::traits::FromCursor;
use crate::frame::Version;
use crate::types::*;
use crate::{error, Error};
/// This modules contains [Cassandra's errors](<https://github.com/apache/cassandra/blob/trunk/doc/native_protocol_v4.spec>)
/// which server could respond to client.
use derive_more::Display;
use std::collections::HashMap;
use std::io::{Cursor, Read};
use std::net::SocketAddr;

/// CDRS error which could be returned by Cassandra server as a response. As in the specification,
/// it contains an error code and an error message. Apart of those depending of type of error,
/// it could contain additional information represented by `additional_info` property.
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct ErrorBody {
    /// Error message.
    pub message: String,
    /// The type of error, possibly including type specific additional information.
    pub ty: ErrorType,
}

impl Serialize for ErrorBody {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        self.ty.to_error_code().serialize(cursor, version);
        serialize_str(cursor, &self.message, version);
        self.ty.serialize(cursor, version);
    }
}

impl FromCursor for ErrorBody {
    fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::Result<ErrorBody> {
        let error_code = CInt::from_cursor(cursor, version)?;
        let message = from_cursor_str(cursor)?.to_string();
        let ty = ErrorType::from_cursor_with_code(cursor, error_code, version)?;

        Ok(ErrorBody { message, ty })
    }
}

impl ErrorBody {
    /// Is the error related to bad protocol used. This is a special case which is used in some
    /// situations to detect when a node should not be contacted.
    pub fn is_bad_protocol(&self) -> bool {
        // based on ProtocolInitHandler from the Datastax driver
        (self.ty == ErrorType::Server || self.ty == ErrorType::Protocol)
            && (self
                .message
                .contains("Invalid or unsupported protocol version")
                || self.message.contains("Beta version of the protocol used"))
    }
}

/// Protocol-dependent failure information. V5 contains a map of endpoint->code entries, while
/// previous versions contain only error count.
#[derive(Debug, PartialEq, Eq, Clone)]
#[non_exhaustive]
pub enum FailureInfo {
    /// Represents the number of nodes that experience a failure while executing the request.
    NumFailures(CInt),
    /// Error code map for affected nodes.
    ReasonMap(HashMap<SocketAddr, CIntShort>),
}

impl Serialize for FailureInfo {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        match self {
            FailureInfo::NumFailures(count) => count.serialize(cursor, version),
            FailureInfo::ReasonMap(map) => {
                let num_failures = map.len() as CInt;
                num_failures.serialize(cursor, version);

                for (endpoint, error_code) in map {
                    endpoint.serialize(cursor, version);
                    error_code.serialize(cursor, version);
                }
            }
        }
    }
}

impl FromCursor for FailureInfo {
    fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::Result<Self> {
        Ok(match version {
            Version::V3 | Version::V4 => Self::NumFailures(CInt::from_cursor(cursor, version)?),
            Version::V5 => {
                let num_failures = CInt::from_cursor(cursor, version)?;
                let mut map = HashMap::with_capacity(num_failures as usize);

                for _ in 0..num_failures {
                    let endpoint = SocketAddr::from_cursor(cursor, version)?;
                    let error_code = CIntShort::from_cursor(cursor, version)?;
                    map.insert(endpoint, error_code);
                }

                Self::ReasonMap(map)
            }
        })
    }
}

/// Additional error info in accordance to
/// [Cassandra protocol v4](<https://github.com/apache/cassandra/blob/trunk/doc/native_protocol_v4.spec>).
#[derive(Debug, PartialEq, Eq, Clone)]
#[non_exhaustive]
pub enum ErrorType {
    Server,
    Protocol,
    Authentication,
    Unavailable(UnavailableError),
    Overloaded,
    IsBootstrapping,
    Truncate,
    WriteTimeout(WriteTimeoutError),
    ReadTimeout(ReadTimeoutError),
    ReadFailure(ReadFailureError),
    FunctionFailure(FunctionFailureError),
    WriteFailure(WriteFailureError),
    Syntax,
    Unauthorized,
    Invalid,
    Config,
    AlreadyExists(AlreadyExistsError),
    Unprepared(UnpreparedError),
}

impl Serialize for ErrorType {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        match self {
            ErrorType::Unavailable(unavailable) => unavailable.serialize(cursor, version),
            ErrorType::WriteTimeout(write_timeout) => write_timeout.serialize(cursor, version),
            ErrorType::ReadTimeout(read_timeout) => read_timeout.serialize(cursor, version),
            ErrorType::ReadFailure(read_failure) => read_failure.serialize(cursor, version),
            ErrorType::FunctionFailure(function_failure) => {
                function_failure.serialize(cursor, version)
            }
            ErrorType::WriteFailure(write_failure) => write_failure.serialize(cursor, version),
            ErrorType::AlreadyExists(already_exists) => already_exists.serialize(cursor, version),
            ErrorType::Unprepared(unprepared) => unprepared.serialize(cursor, version),
            _ => {}
        }
    }
}

impl ErrorType {
    pub fn from_cursor_with_code(
        cursor: &mut Cursor<&[u8]>,
        error_code: CInt,
        version: Version,
    ) -> error::Result<ErrorType> {
        match error_code {
            0x0000 => Ok(ErrorType::Server),
            0x000A => Ok(ErrorType::Protocol),
            0x0100 => Ok(ErrorType::Authentication),
            0x1000 => UnavailableError::from_cursor(cursor, version).map(ErrorType::Unavailable),
            0x1001 => Ok(ErrorType::Overloaded),
            0x1002 => Ok(ErrorType::IsBootstrapping),
            0x1003 => Ok(ErrorType::Truncate),
            0x1100 => WriteTimeoutError::from_cursor(cursor, version).map(ErrorType::WriteTimeout),
            0x1200 => ReadTimeoutError::from_cursor(cursor, version).map(ErrorType::ReadTimeout),
            0x1300 => ReadFailureError::from_cursor(cursor, version).map(ErrorType::ReadFailure),
            0x1400 => {
                FunctionFailureError::from_cursor(cursor, version).map(ErrorType::FunctionFailure)
            }
            0x1500 => WriteFailureError::from_cursor(cursor, version).map(ErrorType::WriteFailure),
            0x2000 => Ok(ErrorType::Syntax),
            0x2100 => Ok(ErrorType::Unauthorized),
            0x2200 => Ok(ErrorType::Invalid),
            0x2300 => Ok(ErrorType::Config),
            0x2400 => {
                AlreadyExistsError::from_cursor(cursor, version).map(ErrorType::AlreadyExists)
            }
            0x2500 => UnpreparedError::from_cursor(cursor, version).map(ErrorType::Unprepared),
            _ => Err(Error::UnexpectedErrorCode(error_code)),
        }
    }

    pub fn to_error_code(&self) -> CInt {
        match self {
            ErrorType::Server => 0x0000,
            ErrorType::Protocol => 0x000A,
            ErrorType::Authentication => 0x0100,
            ErrorType::Unavailable(_) => 0x1000,
            ErrorType::Overloaded => 0x1001,
            ErrorType::IsBootstrapping => 0x1002,
            ErrorType::Truncate => 0x1003,
            ErrorType::WriteTimeout(_) => 0x1100,
            ErrorType::ReadTimeout(_) => 0x1200,
            ErrorType::ReadFailure(_) => 0x1300,
            ErrorType::FunctionFailure(_) => 0x1400,
            ErrorType::WriteFailure(_) => 0x1500,
            ErrorType::Syntax => 0x2000,
            ErrorType::Unauthorized => 0x2100,
            ErrorType::Invalid => 0x2200,
            ErrorType::Config => 0x2300,
            ErrorType::AlreadyExists(_) => 0x2400,
            ErrorType::Unprepared(_) => 0x2500,
        }
    }
}

/// Additional info about
/// [unavailable exception](<https://github.com/apache/cassandra/blob/trunk/doc/native_protocol_v4.spec>)
#[derive(Debug, PartialEq, Ord, PartialOrd, Eq, Copy, Clone, Hash)]
pub struct UnavailableError {
    /// Consistency level of query.
    pub cl: Consistency,
    /// Number of nodes that should be available to respect `cl`.
    pub required: CInt,
    /// Number of replicas that we were know to be alive.
    pub alive: CInt,
}

impl Serialize for UnavailableError {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        self.cl.serialize(cursor, version);
        self.required.serialize(cursor, version);
        self.alive.serialize(cursor, version);
    }
}

impl FromCursor for UnavailableError {
    fn from_cursor(
        cursor: &mut Cursor<&[u8]>,
        version: Version,
    ) -> error::Result<UnavailableError> {
        let cl = Consistency::from_cursor(cursor, version)?;
        let required = CInt::from_cursor(cursor, version)?;
        let alive = CInt::from_cursor(cursor, version)?;

        Ok(UnavailableError {
            cl,
            required,
            alive,
        })
    }
}

/// Timeout exception during a write request.
#[derive(Debug, PartialEq, Clone, Ord, PartialOrd, Eq, Hash)]
pub struct WriteTimeoutError {
    /// Consistency level of query.
    pub cl: Consistency,
    /// `i32` representing the number of nodes having acknowledged the request.
    pub received: CInt,
    /// `i32` representing the number of replicas whose acknowledgement is required to achieve `cl`.
    pub block_for: CInt,
    /// Describes the type of the write that timed out.
    pub write_type: WriteType,
    /// The number of contentions occurred during the CAS operation. The field only presents when
    /// the `write_type` is `Cas`.
    pub contentions: Option<CIntShort>,
}

impl Serialize for WriteTimeoutError {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        self.cl.serialize(cursor, version);
        self.received.serialize(cursor, version);
        self.block_for.serialize(cursor, version);
        self.write_type.serialize(cursor, version);

        if let Some(contentions) = self.contentions {
            contentions.serialize(cursor, version);
        }
    }
}

impl FromCursor for WriteTimeoutError {
    fn from_cursor(
        cursor: &mut Cursor<&[u8]>,
        version: Version,
    ) -> error::Result<WriteTimeoutError> {
        let cl = Consistency::from_cursor(cursor, version)?;
        let received = CInt::from_cursor(cursor, version)?;
        let block_for = CInt::from_cursor(cursor, version)?;
        let write_type = WriteType::from_cursor(cursor, version)?;
        let contentions = if write_type == WriteType::Cas {
            Some(CIntShort::from_cursor(cursor, version)?)
        } else {
            None
        };

        Ok(WriteTimeoutError {
            cl,
            received,
            block_for,
            write_type,
            contentions,
        })
    }
}

/// Timeout exception during a read request.
#[derive(Debug, PartialEq, Ord, PartialOrd, Eq, Copy, Clone, Hash)]
pub struct ReadTimeoutError {
    /// Consistency level of query.
    pub cl: Consistency,
    /// `i32` representing the number of nodes having acknowledged the request.
    pub received: CInt,
    /// `i32` representing the number of replicas whose acknowledgement is required to achieve `cl`.
    pub block_for: CInt,
    data_present: u8,
}

impl Serialize for ReadTimeoutError {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        self.cl.serialize(cursor, version);
        self.received.serialize(cursor, version);
        self.block_for.serialize(cursor, version);
        self.data_present.serialize(cursor, version);
    }
}

impl ReadTimeoutError {
    /// Shows if a replica has responded to a query.
    #[inline]
    pub fn replica_has_responded(&self) -> bool {
        self.data_present != 0
    }
}

impl FromCursor for ReadTimeoutError {
    fn from_cursor(
        cursor: &mut Cursor<&[u8]>,
        version: Version,
    ) -> error::Result<ReadTimeoutError> {
        let cl = Consistency::from_cursor(cursor, version)?;
        let received = CInt::from_cursor(cursor, version)?;
        let block_for = CInt::from_cursor(cursor, version)?;

        let mut buff = [0];
        cursor.read_exact(&mut buff)?;

        let data_present = buff[0];

        Ok(ReadTimeoutError {
            cl,
            received,
            block_for,
            data_present,
        })
    }
}

/// A non-timeout exception during a read request.
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct ReadFailureError {
    /// Consistency level of query.
    pub cl: Consistency,
    /// The number of nodes having acknowledged the request.
    pub received: CInt,
    /// The number of replicas whose acknowledgement is required to achieve `cl`.
    pub block_for: CInt,
    /// Failure information.
    pub failure_info: FailureInfo,
    data_present: u8,
}

impl Serialize for ReadFailureError {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        self.cl.serialize(cursor, version);
        self.received.serialize(cursor, version);
        self.block_for.serialize(cursor, version);
        self.failure_info.serialize(cursor, version);
        self.data_present.serialize(cursor, version);
    }
}

impl ReadFailureError {
    /// Shows if replica has responded to a query.
    #[inline]
    pub fn replica_has_responded(&self) -> bool {
        self.data_present != 0
    }
}

impl FromCursor for ReadFailureError {
    fn from_cursor(
        cursor: &mut Cursor<&[u8]>,
        version: Version,
    ) -> error::Result<ReadFailureError> {
        let cl = Consistency::from_cursor(cursor, version)?;
        let received = CInt::from_cursor(cursor, version)?;
        let block_for = CInt::from_cursor(cursor, version)?;
        let failure_info = FailureInfo::from_cursor(cursor, version)?;

        let mut buff = [0];
        cursor.read_exact(&mut buff)?;

        let data_present = buff[0];

        Ok(ReadFailureError {
            cl,
            received,
            block_for,
            failure_info,
            data_present,
        })
    }
}

/// A (user defined) function failed during execution.
#[derive(Debug, PartialEq, Ord, PartialOrd, Eq, Hash, Clone)]
pub struct FunctionFailureError {
    /// The keyspace of the failed function.
    pub keyspace: String,
    /// The name of the failed function
    pub function: String,
    /// One string for each argument type (as CQL type) of the failed function.
    pub arg_types: Vec<String>,
}

impl Serialize for FunctionFailureError {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        serialize_str(cursor, &self.keyspace, version);
        serialize_str(cursor, &self.function, version);
        serialize_str_list(cursor, self.arg_types.iter().map(|x| x.as_str()), version);
    }
}

impl FromCursor for FunctionFailureError {
    fn from_cursor(
        cursor: &mut Cursor<&[u8]>,
        _version: Version,
    ) -> error::Result<FunctionFailureError> {
        let keyspace = from_cursor_str(cursor)?.to_string();
        let function = from_cursor_str(cursor)?.to_string();
        let arg_types = from_cursor_string_list(cursor)?;

        Ok(FunctionFailureError {
            keyspace,
            function,
            arg_types,
        })
    }
}

/// A non-timeout exception during a write request.
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct WriteFailureError {
    /// Consistency of the query having triggered the exception.
    pub cl: Consistency,
    /// The number of nodes having answered the request.
    pub received: CInt,
    /// The number of replicas whose acknowledgement is required to achieve `cl`.
    pub block_for: CInt,
    /// Failure information.
    pub failure_info: FailureInfo,
    /// describes the type of the write that failed.
    pub write_type: WriteType,
}

impl Serialize for WriteFailureError {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        self.cl.serialize(cursor, version);
        self.received.serialize(cursor, version);
        self.block_for.serialize(cursor, version);
        self.failure_info.serialize(cursor, version);
        self.write_type.serialize(cursor, version);
    }
}

impl FromCursor for WriteFailureError {
    fn from_cursor(
        cursor: &mut Cursor<&[u8]>,
        version: Version,
    ) -> error::Result<WriteFailureError> {
        let cl = Consistency::from_cursor(cursor, version)?;
        let received = CInt::from_cursor(cursor, version)?;
        let block_for = CInt::from_cursor(cursor, version)?;
        let failure_info = FailureInfo::from_cursor(cursor, version)?;
        let write_type = WriteType::from_cursor(cursor, version)?;

        Ok(WriteFailureError {
            cl,
            received,
            block_for,
            failure_info,
            write_type,
        })
    }
}

/// Describes the type of the write that failed.
/// [Read more...](https://github.com/apache/cassandra/blob/trunk/doc/native_protocol_v4.spec#L1118)
#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Hash, Clone, Display)]
#[non_exhaustive]
pub enum WriteType {
    /// The write was a non-batched non-counter write.
    Simple,
    /// The write was a (logged) batch write. If this type is received, it means the batch log
    /// has been successfully written.
    Batch,
    /// The write was an unlogged batch. No batch log write has been attempted.
    UnloggedBatch,
    /// The write was a counter write (batched or not).
    Counter,
    /// The failure occurred during the write to the batch log when a (logged) batch
    /// write was requested.
    BatchLog,
    /// The timeout occurred during the Compare And Set write/update.
    Cas,
    /// The timeout occurred when a write involves VIEW update and failure to acquire local view(MV)
    /// lock for key within timeout.
    View,
    /// The timeout occurred when cdc_total_space is exceeded when doing a write to data tracked by
    /// cdc.
    Cdc,
    /// Unknown write type.
    Unknown(String),
}

impl Serialize for WriteType {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        match self {
            WriteType::Simple => serialize_str(cursor, "SIMPLE", version),
            WriteType::Batch => serialize_str(cursor, "BATCH", version),
            WriteType::UnloggedBatch => serialize_str(cursor, "UNLOGGED_BATCH", version),
            WriteType::Counter => serialize_str(cursor, "COUNTER", version),
            WriteType::BatchLog => serialize_str(cursor, "BATCH_LOG", version),
            WriteType::Cas => serialize_str(cursor, "CAS", version),
            WriteType::View => serialize_str(cursor, "VIEW", version),
            WriteType::Cdc => serialize_str(cursor, "CDC", version),
            WriteType::Unknown(write_type) => serialize_str(cursor, write_type, version),
        }
    }
}

impl FromCursor for WriteType {
    fn from_cursor(cursor: &mut Cursor<&[u8]>, _version: Version) -> error::Result<WriteType> {
        match from_cursor_str(cursor)? {
            "SIMPLE" => Ok(WriteType::Simple),
            "BATCH" => Ok(WriteType::Batch),
            "UNLOGGED_BATCH" => Ok(WriteType::UnloggedBatch),
            "COUNTER" => Ok(WriteType::Counter),
            "BATCH_LOG" => Ok(WriteType::BatchLog),
            "CAS" => Ok(WriteType::Cas),
            "VIEW" => Ok(WriteType::View),
            "CDC" => Ok(WriteType::Cdc),
            wt => Ok(WriteType::Unknown(wt.into())),
        }
    }
}

/// The query attempted to create a keyspace or a table that was already existing.
/// [Read more...](https://github.com/apache/cassandra/blob/trunk/doc/native_protocol_v4.spec#L1140)
#[derive(Debug, PartialEq, Ord, PartialOrd, Eq, Hash, Clone)]
pub struct AlreadyExistsError {
    /// Represents either the keyspace that already exists,
    /// or the keyspace in which the table that already exists is.
    pub ks: String,
    /// Represents the name of the table that already exists.
    pub table: String,
}

impl Serialize for AlreadyExistsError {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        serialize_str(cursor, &self.ks, version);
        serialize_str(cursor, &self.table, version);
    }
}

impl FromCursor for AlreadyExistsError {
    fn from_cursor(
        cursor: &mut Cursor<&[u8]>,
        _version: Version,
    ) -> error::Result<AlreadyExistsError> {
        let ks = from_cursor_str(cursor)?.to_string();
        let table = from_cursor_str(cursor)?.to_string();

        Ok(AlreadyExistsError { ks, table })
    }
}

/// Can be thrown while a prepared statement tries to be
/// executed if the provided prepared statement ID is not known by
/// this host. [Read more...](<https://github.com/apache/cassandra/blob/trunk/doc/native_protocol_v4.spec>)
#[derive(Debug, PartialEq, Ord, PartialOrd, Eq, Hash, Clone)]
pub struct UnpreparedError {
    /// Unknown ID.
    pub id: CBytesShort,
}

impl Serialize for UnpreparedError {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        self.id.serialize(cursor, version);
    }
}

impl FromCursor for UnpreparedError {
    fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::Result<UnpreparedError> {
        let id = CBytesShort::from_cursor(cursor, version)?;
        Ok(UnpreparedError { id })
    }
}

//noinspection DuplicatedCode
#[cfg(test)]
fn test_encode_decode(bytes: &[u8], expected: ErrorBody) {
    {
        let mut cursor: Cursor<&[u8]> = Cursor::new(bytes);
        let result = ErrorBody::from_cursor(&mut cursor, Version::V4).unwrap();
        assert_eq!(expected, result);
    }

    {
        let mut buffer = Vec::new();
        let mut cursor = Cursor::new(&mut buffer);
        expected.serialize(&mut cursor, Version::V4);
        assert_eq!(buffer, bytes);
    }
}

#[cfg(test)]
mod error_tests {
    use super::*;

    #[test]
    fn server() {
        let bytes = &[
            0, 0, 0, 0, // server
            0, 3, 102, 111, 111, // message - foo
        ];
        let expected = ErrorBody {
            message: "foo".into(),
            ty: ErrorType::Server,
        };
        test_encode_decode(bytes, expected);
    }

    #[test]
    fn protocol() {
        let bytes = &[
            0, 0, 0, 10, // protocol
            0, 3, 102, 111, 111, // message - foo
        ];
        let expected = ErrorBody {
            message: "foo".into(),
            ty: ErrorType::Protocol,
        };
        test_encode_decode(bytes, expected);
    }

    #[test]
    fn authentication() {
        let bytes = &[
            0, 0, 1, 0, // authentication error
            0, 3, 102, 111, 111, // message - foo
        ];
        let expected = ErrorBody {
            message: "foo".into(),
            ty: ErrorType::Authentication,
        };
        test_encode_decode(bytes, expected);
    }

    #[test]
    fn unavailable() {
        let bytes = &[
            0, 0, 16, 0, // unavailable
            0, 3, 102, 111, 111, // message - foo
            //
            // unavailable error
            0, 0, // consistency any
            0, 0, 0, 1, // required
            0, 0, 0, 1, // alive
        ];
        let expected = ErrorBody {
            message: "foo".into(),
            ty: ErrorType::Unavailable(UnavailableError {
                cl: Consistency::Any,
                required: 1,
                alive: 1,
            }),
        };
        test_encode_decode(bytes, expected);
    }

    #[test]
    fn overloaded() {
        let bytes = &[
            0, 0, 16, 1, // authentication error
            0, 3, 102, 111, 111, // message - foo
        ];
        let expected = ErrorBody {
            message: "foo".into(),
            ty: ErrorType::Overloaded,
        };
        test_encode_decode(bytes, expected);
    }

    #[test]
    fn is_bootstrapping() {
        let bytes = &[
            0, 0, 16, 2, // is bootstrapping
            0, 3, 102, 111, 111, // message - foo
        ];
        let expected = ErrorBody {
            message: "foo".into(),
            ty: ErrorType::IsBootstrapping,
        };
        test_encode_decode(bytes, expected);
    }

    #[test]
    fn truncate() {
        let bytes = &[
            0, 0, 16, 3, // truncate
            0, 3, 102, 111, 111, // message - foo
        ];
        let expected = ErrorBody {
            message: "foo".into(),
            ty: ErrorType::Truncate,
        };
        test_encode_decode(bytes, expected);
    }

    #[test]
    fn write_timeout() {
        let bytes = &[
            0, 0, 17, 0, // write timeout
            0, 3, 102, 111, 111, // message - foo
            //
            // timeout error
            0, 0, // consistency any
            0, 0, 0, 1, // received
            0, 0, 0, 1, // block_for
            0, 6, 83, 73, 77, 80, 76, 69, // Write type simple
        ];
        let expected = ErrorBody {
            message: "foo".into(),
            ty: ErrorType::WriteTimeout(WriteTimeoutError {
                cl: Consistency::Any,
                received: 1,
                block_for: 1,
                write_type: WriteType::Simple,
                contentions: None,
            }),
        };
        test_encode_decode(bytes, expected);
    }

    #[test]
    fn read_timeout() {
        let bytes = &[
            0, 0, 18, 0, // read timeout
            0, 3, 102, 111, 111, // message - foo
            //
            // read timeout
            0, 0, // consistency any
            0, 0, 0, 1, // received
            0, 0, 0, 1, // block_for
            0, // data present
        ];
        let expected = ErrorBody {
            message: "foo".into(),
            ty: ErrorType::ReadTimeout(ReadTimeoutError {
                cl: Consistency::Any,
                received: 1,
                block_for: 1,
                data_present: 0,
            }),
        };
        test_encode_decode(bytes, expected);
    }

    #[test]
    fn read_failure() {
        let bytes = &[
            0, 0, 19, 0, // read failure
            0, 3, 102, 111, 111, // message - foo
            //
            // read timeout
            0, 0, // consistency any
            0, 0, 0, 1, // received
            0, 0, 0, 1, // block_for
            0, 0, 0, 1, // num failure
            0, // data present
        ];
        let expected = ErrorBody {
            message: "foo".into(),
            ty: ErrorType::ReadFailure(ReadFailureError {
                cl: Consistency::Any,
                received: 1,
                block_for: 1,
                failure_info: FailureInfo::NumFailures(1),
                data_present: 0,
            }),
        };
        test_encode_decode(bytes, expected);
    }

    #[test]
    fn syntax() {
        let bytes = &[
            0, 0, 32, 0, // syntax
            0, 3, 102, 111, 111, // message - foo
        ];
        let expected = ErrorBody {
            message: "foo".into(),
            ty: ErrorType::Syntax,
        };
        test_encode_decode(bytes, expected);
    }

    #[test]
    fn unauthorized() {
        let bytes = &[
            0, 0, 33, 0, // unauthorized
            0, 3, 102, 111, 111, // message - foo
        ];
        let expected = ErrorBody {
            message: "foo".into(),
            ty: ErrorType::Unauthorized,
        };
        test_encode_decode(bytes, expected);
    }

    #[test]
    fn invalid() {
        let bytes = &[
            0, 0, 34, 0, // invalid
            0, 3, 102, 111, 111, // message - foo
        ];
        let expected = ErrorBody {
            message: "foo".into(),
            ty: ErrorType::Invalid,
        };
        test_encode_decode(bytes, expected);
    }

    #[test]
    fn config() {
        let bytes = &[
            0, 0, 35, 0, // config
            0, 3, 102, 111, 111, // message - foo
        ];
        let expected = ErrorBody {
            message: "foo".into(),
            ty: ErrorType::Config,
        };
        test_encode_decode(bytes, expected);
    }
}


================================================
FILE: cassandra-protocol/src/frame/message_event.rs
================================================
use crate::error;
use crate::frame::events::ServerEvent;
use crate::frame::Serialize;
use crate::frame::{FromCursor, Version};
use std::io::Cursor;

#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub struct BodyResEvent {
    pub event: ServerEvent,
}

impl Serialize for BodyResEvent {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        self.event.serialize(cursor, version);
    }
}

impl FromCursor for BodyResEvent {
    fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::Result<BodyResEvent> {
        let event = ServerEvent::from_cursor(cursor, version)?;
        Ok(BodyResEvent { event })
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::frame::events::*;
    use crate::frame::traits::FromCursor;
    use std::io::Cursor;

    #[test]
    fn body_res_event() {
        let bytes = &[
            // TOPOLOGY_CHANGE
            0, 15, 84, 79, 80, 79, 76, 79, 71, 89, 95, 67, 72, 65, 78, 71, 69, // NEW_NODE
            0, 8, 78, 69, 87, 95, 78, 79, 68, 69, //
            4, 127, 0, 0, 1, 0, 0, 0, 1, // inet - 127.0.0.1:1
        ];
        let expected = ServerEvent::TopologyChange(TopologyChange {
            change_type: TopologyChangeType::NewNode,
            addr: "127.0.0.1:1".parse().unwrap(),
        });

        {
            let mut cursor: Cursor<&[u8]> = Cursor::new(bytes);
            let event = BodyResEvent::from_cursor(&mut cursor, Version::V4)
                .unwrap()
                .event;
            assert_eq!(event, expected);
        }

        {
            let mut buffer = Vec::new();
            let mut cursor = Cursor::new(&mut buffer);
            expected.serialize(&mut cursor, Version::V4);
            assert_eq!(buffer, bytes);
        }
    }
}


================================================
FILE: cassandra-protocol/src/frame/message_execute.rs
================================================
use crate::error;
use crate::frame::{Direction, Envelope, Flags, FromCursor, Opcode, Serialize, Version};
use crate::query::QueryParams;
use crate::types::CBytesShort;
use derive_more::Constructor;
use std::io::Cursor;

/// The structure that represents a body of a envelope of type `execute`.
#[derive(Debug, Constructor, Eq, PartialEq, Clone)]
pub struct BodyReqExecute<'a> {
    pub id: &'a CBytesShort,
    pub result_metadata_id: Option<&'a CBytesShort>,
    pub query_parameters: &'a QueryParams,
}

impl<'a> Serialize for BodyReqExecute<'a> {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        self.id.serialize(cursor, version);

        if let Some(result_metadata_id) = self.result_metadata_id {
            result_metadata_id.serialize(cursor, version);
        }

        self.query_parameters.serialize(cursor, version);
    }

    #[inline]
    fn serialize_to_vec(&self, version: Version) -> Vec<u8> {
        let mut buf = Vec::with_capacity(
            self.id.serialized_len()
                + self
                    .result_metadata_id
                    .map(|id| id.serialized_len())
                    .unwrap_or(0),
        );

        self.serialize(&mut Cursor::new(&mut buf), version);
        buf
    }
}

/// The structure that represents an owned body of a envelope of type `execute`.
#[derive(Debug, Constructor, Clone, Eq, PartialEq, Default)]
pub struct BodyReqExecuteOwned {
    pub id: CBytesShort,
    pub result_metadata_id: Option<CBytesShort>,
    pub query_parameters: QueryParams,
}

impl FromCursor for BodyReqExecuteOwned {
    fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::Result<Self> {
        let id = CBytesShort::from_cursor(cursor, version)?;

        let result_metadata_id = if version >= Version::V5 {
            Some(CBytesShort::from_cursor(cursor, version)?)
        } else {
            None
        };

        let query_parameters = QueryParams::from_cursor(cursor, version)?;

        Ok(BodyReqExecuteOwned::new(
            id,
            result_metadata_id,
            query_parameters,
        ))
    }
}

impl Serialize for BodyReqExecuteOwned {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        BodyReqExecute::new(
            &self.id,
            self.result_metadata_id.as_ref(),
            &self.query_parameters,
        )
        .serialize(cursor, version);
    }
}

impl Envelope {
    pub fn new_req_execute(
        id: &CBytesShort,
        result_metadata_id: Option<&CBytesShort>, // only required for protocol >= V5
        query_parameters: &QueryParams,
        flags: Flags,
        version: Version,
    ) -> Envelope {
        let direction = Direction::Request;
        let opcode = Opcode::Execute;

        let body = BodyReqExecute::new(id, result_metadata_id, query_parameters);

        Envelope::new(
            version,
            direction,
            flags,
            opcode,
            0,
            body.serialize_to_vec(version),
            None,
            vec![],
        )
    }
}

#[cfg(test)]
mod tests {
    use crate::consistency::Consistency;
    use crate::frame::message_execute::BodyReqExecuteOwned;
    use crate::frame::traits::Serialize;
    use crate::frame::{FromCursor, Version};
    use crate::query::QueryParams;
    use crate::types::CBytesShort;
    use std::io::Cursor;

    #[test]
    fn should_deserialize_body() {
        let data = [0, 1, 2, 0, 0, 0];
        let mut cursor = Cursor::new(data.as_slice());

        let body = BodyReqExecuteOwned::from_cursor(&mut cursor, Version::V4).unwrap();
        assert_eq!(body.id, CBytesShort::new(vec![2]));
        assert_eq!(body.query_parameters.consistency, Consistency::Any);
    }

    #[test]
    fn should_support_result_metadata_id() {
        let body = BodyReqExecuteOwned::new(
            CBytesShort::new(vec![1]),
            Some(CBytesShort::new(vec![2])),
            QueryParams::default(),
        );
        let data = body.serialize_to_vec(Version::V5);
        assert_eq!(
            BodyReqExecuteOwned::from_cursor(&mut Cursor::new(&data), Version::V5).unwrap(),
            body
        );
    }
}


================================================
FILE: cassandra-protocol/src/frame/message_options.rs
================================================
use crate::error;
use crate::frame::{Direction, Envelope, Flags, FromCursor, Opcode, Serialize, Version};
use std::io::Cursor;

/// The structure which represents a body of a envelope of type `options`.
#[derive(Debug, Default, Ord, PartialOrd, Eq, PartialEq, Hash, Copy, Clone)]
pub struct BodyReqOptions;

impl Serialize for BodyReqOptions {
    #[inline(always)]
    fn serialize(&self, _cursor: &mut Cursor<&mut Vec<u8>>, _version: Version) {}
}

impl FromCursor for BodyReqOptions {
    #[inline(always)]
    fn from_cursor(_cursor: &mut Cursor<&[u8]>, _version: Version) -> error::Result<Self> {
        Ok(BodyReqOptions)
    }
}

impl Envelope {
    /// Creates new envelope of type `options`.
    pub fn new_req_options(version: Version) -> Envelope {
        let direction = Direction::Request;
        let opcode = Opcode::Options;
        let body: BodyReqOptions = Default::default();

        Envelope::new(
            version,
            direction,
            Flags::empty(),
            opcode,
            0,
            body.serialize_to_vec(version),
            None,
            vec![],
        )
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_frame_options() {
        let frame = Envelope::new_req_options(Version::V4);
        assert_eq!(frame.version, Version::V4);
        assert_eq!(frame.opcode, Opcode::Options);
        assert!(frame.body.is_empty());
    }
}


================================================
FILE: cassandra-protocol/src/frame/message_prepare.rs
================================================
use crate::error;
use crate::frame::{Direction, Envelope, Flags, FromCursor, Opcode, Serialize, Version};
use crate::query::PrepareFlags;
use crate::types::{
    from_cursor_str, from_cursor_str_long, serialize_str, serialize_str_long, INT_LEN, SHORT_LEN,
};
use std::io::Cursor;

/// Struct that represents a body of a envelope of type `prepare`
#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Hash, Clone, Default)]
pub struct BodyReqPrepare {
    pub query: String,
    pub keyspace: Option<String>,
}

impl BodyReqPrepare {
    /// Creates new body of a envelope of type `prepare` that prepares query `query`.
    #[inline]
    pub fn new(query: String, keyspace: Option<String>) -> BodyReqPrepare {
        BodyReqPrepare { query, keyspace }
    }
}

impl Serialize for BodyReqPrepare {
    #[inline]
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        serialize_str_long(cursor, &self.query, version);

        if version >= Version::V5 {
            if let Some(keyspace) = &self.keyspace {
                PrepareFlags::WITH_KEYSPACE.serialize(cursor, version);
                serialize_str(cursor, keyspace.as_str(), version);
            } else {
                PrepareFlags::empty().serialize(cursor, version);
            }
        }
    }

    #[inline]
    fn serialize_to_vec(&self, version: Version) -> Vec<u8> {
        let mut buf = if version >= Version::V5 {
            Vec::with_capacity(
                INT_LEN * 2
                    + self.query.len()
                    + self
                        .keyspace
                        .as_ref()
                        .map(|keyspace| SHORT_LEN + keyspace.len())
                        .unwrap_or(0),
            )
        } else {
            Vec::with_capacity(INT_LEN + self.query.len())
        };

        self.serialize(&mut Cursor::new(&mut buf), version);
        buf
    }
}

impl FromCursor for BodyReqPrepare {
    #[inline]
    fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::Result<Self> {
        if version >= Version::V5 {
            from_cursor_str_long(cursor)
                .and_then(|query| {
                    PrepareFlags::from_cursor(cursor, version).map(|flags| (query, flags))
                })
                .and_then(|(query, flags)| {
                    if flags.contains(PrepareFlags::WITH_KEYSPACE) {
                        from_cursor_str(cursor).map(|keyspace| {
                            BodyReqPrepare::new(query.into(), Some(keyspace.into()))
                        })
                    } else {
                        Ok(BodyReqPrepare::new(query.into(), None))
                    }
                })
        } else {
            from_cursor_str_long(cursor).map(|query| BodyReqPrepare::new(query.into(), None))
        }
    }
}

impl Envelope {
    pub fn new_req_prepare(
        query: String,
        keyspace: Option<String>,
        flags: Flags,
        version: Version,
    ) -> Envelope {
        let direction = Direction::Request;
        let opcode = Opcode::Prepare;
        let body = BodyReqPrepare::new(query, keyspace);

        Envelope::new(
            version,
            direction,
            flags,
            opcode,
            0,
            body.serialize_to_vec(version),
            None,
            vec![],
        )
    }
}

#[cfg(test)]
mod tests {
    use crate::frame::message_prepare::BodyReqPrepare;
    use crate::frame::{FromCursor, Serialize, Version};
    use std::io::Cursor;

    #[test]
    fn should_deserialize_body() {
        let data = [0, 0, 0, 3, 102, 111, 111, 0];
        let mut cursor = Cursor::new(data.as_slice());

        let body = BodyReqPrepare::from_cursor(&mut cursor, Version::V4).unwrap();
        assert_eq!(body.query, "foo");
    }

    #[test]
    fn should_support_keyspace() {
        let keyspace = "abc";
        let query = "test";

        let body = BodyReqPrepare::new(query.into(), Some(keyspace.into()));

        let data_v4 = body.serialize_to_vec(Version::V4);
        let body_v4 =
            BodyReqPrepare::from_cursor(&mut Cursor::new(data_v4.as_slice()), Version::V4).unwrap();
        assert_eq!(body_v4.query, query);
        assert_eq!(body_v4.keyspace, None);

        let data_v5 = body.serialize_to_vec(Version::V5);
        let body_v5 =
            BodyReqPrepare::from_cursor(&mut Cursor::new(data_v5.as_slice()), Version::V5).unwrap();
        assert_eq!(body_v5.query, query);
        assert_eq!(body_v5.keyspace, Some(keyspace.to_string()));
    }
}


================================================
FILE: cassandra-protocol/src/frame/message_query.rs
================================================
use crate::consistency::Consistency;
use crate::error;
use crate::frame::traits::FromCursor;
use crate::frame::{Direction, Envelope, Flags, Opcode, Serialize, Version};
use crate::query::{QueryParams, QueryValues};
use crate::types::{from_cursor_str_long, serialize_str_long, CBytes, CInt, CLong, INT_LEN};
use std::io::Cursor;

/// Structure which represents body of Query request
#[derive(Debug, PartialEq, Eq, Clone, Default)]
pub struct BodyReqQuery {
    /// Query string.
    pub query: String,
    /// Query parameters.
    pub query_params: QueryParams,
}

impl BodyReqQuery {
    #[allow(clippy::too_many_arguments)]
    fn new(
        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>,
    ) -> BodyReqQuery {
        BodyReqQuery {
            query,
            query_params: QueryParams {
                consistency,
                with_names,
                values,
                page_size,
                paging_state,
                serial_consistency,
                timestamp,
                keyspace,
                now_in_seconds,
            },
        }
    }
}

impl FromCursor for BodyReqQuery {
    fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::Result<BodyReqQuery> {
        let query = from_cursor_str_long(cursor)?.to_string();
        let query_params = QueryParams::from_cursor(cursor, version)?;

        Ok(BodyReqQuery {
            query,
            query_params,
        })
    }
}

impl Serialize for BodyReqQuery {
    #[inline]
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        serialize_str_long(cursor, &self.query, version);
        self.query_params.serialize(cursor, version);
    }

    #[inline]
    fn serialize_to_vec(&self, version: Version) -> Vec<u8> {
        let mut buf = Vec::with_capacity(INT_LEN + self.query.len());

        self.serialize(&mut Cursor::new(&mut buf), version);
        buf
    }
}

impl Envelope {
    #[allow(clippy::too_many_arguments)]
    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 {
        let direction = Direction::Request;
        let opcode = Opcode::Query;
        let body = BodyReqQuery::new(
            query,
            consistency,
            values,
            with_names,
            page_size,
            paging_state,
            serial_consistency,
            timestamp,
            keyspace,
            now_in_seconds,
        );

        Envelope::new(
            version,
            direction,
            flags,
            opcode,
            0,
            body.serialize_to_vec(version),
            None,
            vec![],
        )
    }

    #[inline]
    pub fn new_query(query: BodyReqQuery, flags: Flags, version: Version) -> Envelope {
        Envelope::new_req_query(
            query.query,
            query.query_params.consistency,
            query.query_params.values,
            query.query_params.with_names,
            query.query_params.page_size,
            query.query_params.paging_state,
            query.query_params.serial_consistency,
            query.query_params.timestamp,
            query.query_params.keyspace,
            query.query_params.now_in_seconds,
            flags,
            version,
        )
    }
}


================================================
FILE: cassandra-protocol/src/frame/message_ready.rs
================================================
use crate::error;
use crate::frame::{FromCursor, Serialize, Version};
use std::io::Cursor;

#[derive(Clone, Debug, PartialEq, Default, Ord, PartialOrd, Eq, Hash, Copy)]
pub struct BodyResReady;

impl Serialize for BodyResReady {
    #[inline(always)]
    fn serialize(&self, _cursor: &mut Cursor<&mut Vec<u8>>, _version: Version) {}
}

impl FromCursor for BodyResReady {
    #[inline(always)]
    fn from_cursor(_cursor: &mut Cursor<&[u8]>, _version: Version) -> error::Result<Self> {
        Ok(BodyResReady)
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn body_res_ready_new() {
        let body: BodyResReady = Default::default();
        assert_eq!(body, BodyResReady);
    }

    #[test]
    fn body_res_ready_serialize() {
        let body = BodyResReady;
        assert!(body.serialize_to_vec(Version::V4).is_empty());
    }
}


================================================
FILE: cassandra-protocol/src/frame/message_register.rs
================================================
use crate::error;
use crate::frame::events::SimpleServerEvent;
use crate::frame::{Direction, Envelope, Flags, FromCursor, Opcode, Serialize, Version};
use crate::types::{from_cursor_string_list, serialize_str_list};
use derive_more::Constructor;
use itertools::Itertools;
use std::convert::TryFrom;
use std::io::Cursor;

/// The structure which represents a body of a envelope of type `register`.
#[derive(Debug, Constructor, Default, Ord, PartialOrd, Eq, PartialEq, Hash, Clone)]
pub struct BodyReqRegister {
    pub events: Vec<SimpleServerEvent>,
}

impl Serialize for BodyReqRegister {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        let events = self.events.iter().map(|event| event.as_str());
        serialize_str_list(cursor, events, version);
    }
}

impl FromCursor for BodyReqRegister {
    fn from_cursor(cursor: &mut Cursor<&[u8]>, _version: Version) -> error::Result<Self> {
        let events = from_cursor_string_list(cursor)?;
        events
            .iter()
            .map(|event| SimpleServerEvent::try_from(event.as_str()))
            .try_collect()
            .map(BodyReqRegister::new)
    }
}

impl Envelope {
    /// Creates new envelope of type `REGISTER`.
    pub fn new_req_register(events: Vec<SimpleServerEvent>, version: Version) -> Envelope {
        let direction = Direction::Request;
        let opcode = Opcode::Register;
        let register_body = BodyReqRegister::new(events);

        Envelope::new(
            version,
            direction,
            Flags::empty(),
            opcode,
            0,
            register_body.serialize_to_vec(version),
            None,
            vec![],
        )
    }
}

#[cfg(test)]
mod tests {
    use crate::events::SimpleServerEvent;
    use crate::frame::message_register::BodyReqRegister;
    use crate::frame::{FromCursor, Version};
    use std::io::Cursor;

    #[test]
    fn should_deserialize_body() {
        let data = [
            0, 1, 0, 15, 0x54, 0x4f, 0x50, 0x4f, 0x4c, 0x4f, 0x47, 0x59, 0x5f, 0x43, 0x48, 0x41,
            0x4e, 0x47, 0x45,
        ];
        let mut cursor = Cursor::new(data.as_slice());

        let body = BodyReqRegister::from_cursor(&mut cursor, Version::V4).unwrap();
        assert_eq!(body.events, vec![SimpleServerEvent::TopologyChange]);
    }
}


================================================
FILE: cassandra-protocol/src/frame/message_request.rs
================================================
use std::io::Cursor;

use crate::frame::message_auth_response::BodyReqAuthResponse;
use crate::frame::message_batch::BodyReqBatch;
use crate::frame::message_execute::BodyReqExecuteOwned;
use crate::frame::message_options::BodyReqOptions;
use crate::frame::message_prepare::BodyReqPrepare;
use crate::frame::message_query::BodyReqQuery;
use crate::frame::message_register::BodyReqRegister;
use crate::frame::message_startup::BodyReqStartup;
use crate::frame::{FromCursor, Opcode, Serialize, Version};
use crate::{error, Error};

#[derive(Debug, PartialEq, Eq, Clone)]
#[allow(clippy::large_enum_variant)]
#[non_exhaustive]
pub enum RequestBody {
    Startup(BodyReqStartup),
    Options(BodyReqOptions),
    Query(BodyReqQuery),
    Prepare(BodyReqPrepare),
    Execute(BodyReqExecuteOwned),
    Register(BodyReqRegister),
    Batch(BodyReqBatch),
    AuthResponse(BodyReqAuthResponse),
}

impl Serialize for RequestBody {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        match self {
            RequestBody::Query(body) => body.serialize(cursor, version),
            RequestBody::Startup(body) => body.serialize(cursor, version),
            RequestBody::Options(body) => body.serialize(cursor, version),
            RequestBody::Prepare(body) => body.serialize(cursor, version),
            RequestBody::Execute(body) => body.serialize(cursor, version),
            RequestBody::Register(body) => body.serialize(cursor, version),
            RequestBody::Batch(body) => body.serialize(cursor, version),
            RequestBody::AuthResponse(body) => body.serialize(cursor, version),
        }
    }
}

impl RequestBody {
    pub fn try_from(
        bytes: &[u8],
        response_type: Opcode,
        version: Version,
    ) -> error::Result<RequestBody> {
        let mut cursor: Cursor<&[u8]> = Cursor::new(bytes);
        match response_type {
            Opcode::Startup => {
                BodyReqStartup::from_cursor(&mut cursor, version).map(RequestBody::Startup)
            }
            Opcode::Options => {
                BodyReqOptions::from_cursor(&mut cursor, version).map(RequestBody::Options)
            }
            Opcode::Query => {
                BodyReqQuery::from_cursor(&mut cursor, version).map(RequestBody::Query)
            }
            Opcode::Prepare => {
                BodyReqPrepare::from_cursor(&mut cursor, version).map(RequestBody::Prepare)
            }
            Opcode::Execute => {
                BodyReqExecuteOwned::from_cursor(&mut cursor, version).map(RequestBody::Execute)
            }
            Opcode::Register => {
                BodyReqRegister::from_cursor(&mut cursor, version).map(RequestBody::Register)
            }
            Opcode::Batch => {
                BodyReqBatch::from_cursor(&mut cursor, version).map(RequestBody::Batch)
            }
            Opcode::AuthResponse => BodyReqAuthResponse::from_cursor(&mut cursor, version)
                .map(RequestBody::AuthResponse),
            _ => Err(Error::NonRequestOpcode(response_type)),
        }
    }
}


================================================
FILE: cassandra-protocol/src/frame/message_response.rs
================================================
use std::io::Cursor;

use crate::frame::message_auth_challenge::BodyResAuthChallenge;
use crate::frame::message_auth_success::BodyReqAuthSuccess;
use crate::frame::message_authenticate::BodyResAuthenticate;
use crate::frame::message_error::ErrorBody;
use crate::frame::message_event::BodyResEvent;
use crate::frame::message_result::{
    BodyResResultPrepared, BodyResResultRows, BodyResResultSetKeyspace, ResResultBody, RowsMetadata,
};
use crate::frame::message_supported::BodyResSupported;
use crate::frame::{FromCursor, Opcode, Version};
use crate::types::rows::Row;
use crate::{error, Error};

#[derive(Debug, PartialEq, Eq, Clone)]
#[non_exhaustive]
pub enum ResponseBody {
    Error(ErrorBody),
    Ready,
    Authenticate(BodyResAuthenticate),
    Supported(BodyResSupported),
    Result(ResResultBody),
    Event(BodyResEvent),
    AuthChallenge(BodyResAuthChallenge),
    AuthSuccess(BodyReqAuthSuccess),
}

// This implementation is incomplete so only enable in tests
#[cfg(test)]
use crate::frame::Serialize;
#[cfg(test)]
impl Serialize for ResponseBody {
    fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
        match self {
            ResponseBody::Error(error_body) => {
                error_body.serialize(cursor, version);
            }
            ResponseBody::Ready => {}
            ResponseBody::Authenticate(auth) => {
                auth.serialize(cursor, version);
            }
            ResponseBody::Supported(supported) => {
                supported.serialize(cursor, version);
            }
            ResponseBody::Result(result) => {
                result.serialize(cursor, version);
            }
            ResponseBody::Event(event) => {
                event.serialize(cursor, version);
            }
            ResponseBody::AuthChallenge(auth_challenge) => {
                auth_challenge.serialize(cursor, version);
            }
            ResponseBody::AuthSuccess(auth_success) => {
                auth_success.serialize(cursor, version);
            }
        }
    }
}

impl ResponseBody {
    pub fn try_from(
        bytes: &[u8],
        response_type: Opcode,
        version: Version,
    ) -> error::Result<ResponseBody> {
        let mut cursor: Cursor<&[u8]> = Cursor::new(bytes);
        match response_type {
            Opcode::Error => ErrorBody::from_cursor(&mut cursor, version).map(Respon
Download .txt
gitextract_xk4fwcia/

├── .github/
│   ├── FUNDING.yml
│   ├── dependabot.yml
│   ├── stale.yml
│   └── workflows/
│       └── rust.yml
├── .gitignore
├── Cargo.toml
├── LICENSE-APACHE
├── LICENSE-MIT
├── README.md
├── cassandra-ports.txt
├── cassandra-protocol/
│   ├── Cargo.toml
│   ├── README.md
│   └── src/
│       ├── authenticators.rs
│       ├── compression.rs
│       ├── consistency.rs
│       ├── crc.rs
│       ├── error.rs
│       ├── events.rs
│       ├── frame/
│       │   ├── events.rs
│       │   ├── frame_decoder.rs
│       │   ├── frame_encoder.rs
│       │   ├── message_auth_challenge.rs
│       │   ├── message_auth_response.rs
│       │   ├── message_auth_success.rs
│       │   ├── message_authenticate.rs
│       │   ├── message_batch.rs
│       │   ├── message_error.rs
│       │   ├── message_event.rs
│       │   ├── message_execute.rs
│       │   ├── message_options.rs
│       │   ├── message_prepare.rs
│       │   ├── message_query.rs
│       │   ├── message_ready.rs
│       │   ├── message_register.rs
│       │   ├── message_request.rs
│       │   ├── message_response.rs
│       │   ├── message_result.rs
│       │   ├── message_startup.rs
│       │   ├── message_supported.rs
│       │   └── traits.rs
│       ├── frame.rs
│       ├── lib.rs
│       ├── macros.rs
│       ├── query/
│       │   ├── batch_query_builder.rs
│       │   ├── prepare_flags.rs
│       │   ├── prepared_query.rs
│       │   ├── query_flags.rs
│       │   ├── query_params.rs
│       │   ├── query_params_builder.rs
│       │   ├── query_values.rs
│       │   └── utils.rs
│       ├── query.rs
│       ├── token.rs
│       ├── types/
│       │   ├── blob.rs
│       │   ├── cassandra_type.rs
│       │   ├── data_serialization_types.rs
│       │   ├── decimal.rs
│       │   ├── duration.rs
│       │   ├── from_cdrs.rs
│       │   ├── list.rs
│       │   ├── map.rs
│       │   ├── rows.rs
│       │   ├── tuple.rs
│       │   ├── udt.rs
│       │   ├── value.rs
│       │   └── vector.rs
│       └── types.rs
├── cdrs-tokio/
│   ├── Cargo.toml
│   ├── examples/
│   │   ├── README.md
│   │   ├── crud_operations.rs
│   │   ├── generic_connection.rs
│   │   ├── insert_collection.rs
│   │   ├── multiple_thread.rs
│   │   ├── paged_query.rs
│   │   └── prepare_batch_execute.rs
│   ├── src/
│   │   ├── cluster/
│   │   │   ├── cluster_metadata_manager.rs
│   │   │   ├── config_proxy.rs
│   │   │   ├── config_rustls.rs
│   │   │   ├── config_tcp.rs
│   │   │   ├── connection_manager.rs
│   │   │   ├── connection_pool.rs
│   │   │   ├── control_connection.rs
│   │   │   ├── keyspace_holder.rs
│   │   │   ├── metadata_builder.rs
│   │   │   ├── node_address.rs
│   │   │   ├── node_info.rs
│   │   │   ├── pager.rs
│   │   │   ├── rustls_connection_manager.rs
│   │   │   ├── send_envelope.rs
│   │   │   ├── session.rs
│   │   │   ├── session_context.rs
│   │   │   ├── tcp_connection_manager.rs
│   │   │   ├── token_map.rs
│   │   │   ├── topology/
│   │   │   │   ├── cluster_metadata.rs
│   │   │   │   ├── datacenter_metadata.rs
│   │   │   │   ├── keyspace_metadata.rs
│   │   │   │   ├── node.rs
│   │   │   │   ├── node_distance.rs
│   │   │   │   ├── node_state.rs
│   │   │   │   └── replication_strategy.rs
│   │   │   └── topology.rs
│   │   ├── cluster.rs
│   │   ├── envelope_parser.rs
│   │   ├── frame_encoding.rs
│   │   ├── future.rs
│   │   ├── lib.rs
│   │   ├── load_balancing/
│   │   │   ├── initializing_wrapper.rs
│   │   │   ├── node_distance_evaluator.rs
│   │   │   ├── random.rs
│   │   │   ├── request.rs
│   │   │   ├── round_robin.rs
│   │   │   └── topology_aware.rs
│   │   ├── load_balancing.rs
│   │   ├── macros.rs
│   │   ├── retry/
│   │   │   ├── reconnection_policy.rs
│   │   │   └── retry_policy.rs
│   │   ├── retry.rs
│   │   ├── speculative_execution.rs
│   │   ├── statement/
│   │   │   ├── statement_params.rs
│   │   │   └── statement_params_builder.rs
│   │   ├── statement.rs
│   │   └── transport.rs
│   └── tests/
│       ├── collection_types.rs
│       ├── common.rs
│       ├── compression.rs
│       ├── derive_traits.rs
│       ├── keyspace.rs
│       ├── multi_node_speculative_execution.rs
│       ├── multithread.rs
│       ├── native_types.rs
│       ├── paged_query.rs
│       ├── query_values.rs
│       ├── single_node_speculative_execution.rs
│       ├── topology_aware.rs
│       ├── tuple_types.rs
│       └── user_defined_types.rs
├── cdrs-tokio-helpers-derive/
│   ├── Cargo.toml
│   ├── README.md
│   └── src/
│       ├── common.rs
│       ├── db_mirror.rs
│       ├── into_cdrs_value.rs
│       ├── lib.rs
│       ├── try_from_row.rs
│       └── try_from_udt.rs
├── changelog.md
├── clippy.toml
├── documentation/
│   ├── README.md
│   ├── batching-multiple-queries.md
│   ├── cdrs-session.md
│   ├── cluster-configuration.md
│   ├── deserialization.md
│   ├── preparing-and-executing-queries.md
│   ├── query-values.md
│   └── type-mapping.md
└── rustfmt.toml
Download .txt
SYMBOL INDEX (1581 symbols across 123 files)

FILE: cassandra-protocol/src/authenticators.rs
  type SaslAuthenticator (line 15) | pub trait SaslAuthenticator {
    method initial_response (line 16) | fn initial_response(&self) -> CBytes;
    method evaluate_challenge (line 18) | fn evaluate_challenge(&self, challenge: CBytes) -> Result<CBytes>;
    method handle_success (line 20) | fn handle_success(&self, data: CBytes) -> Result<()>;
    method initial_response (line 46) | fn initial_response(&self) -> CBytes {
    method evaluate_challenge (line 55) | fn evaluate_challenge(&self, _challenge: CBytes) -> Result<CBytes> {
    method handle_success (line 59) | fn handle_success(&self, _data: CBytes) -> Result<()> {
    method initial_response (line 97) | fn initial_response(&self) -> CBytes {
    method evaluate_challenge (line 101) | fn evaluate_challenge(&self, _challenge: CBytes) -> Result<CBytes> {
    method handle_success (line 105) | fn handle_success(&self, _data: CBytes) -> Result<()> {
  type SaslAuthenticatorProvider (line 24) | pub trait SaslAuthenticatorProvider {
    method name (line 25) | fn name(&self) -> Option<&str>;
    method create_authenticator (line 27) | fn create_authenticator(&self) -> Box<dyn SaslAuthenticator + Send>;
    method name (line 72) | fn name(&self) -> Option<&str> {
    method create_authenticator (line 76) | fn create_authenticator(&self) -> Box<dyn SaslAuthenticator + Send> {
    method name (line 115) | fn name(&self) -> Option<&str> {
    method create_authenticator (line 119) | fn create_authenticator(&self) -> Box<dyn SaslAuthenticator + Send> {
  type StaticPasswordAuthenticator (line 31) | pub struct StaticPasswordAuthenticator {
    method new (line 37) | pub fn new<S: ToString>(username: S, password: S) -> StaticPasswordAut...
  type StaticPasswordAuthenticatorProvider (line 66) | pub struct StaticPasswordAuthenticatorProvider {
    method new (line 85) | pub fn new<S: ToString>(username: S, password: S) -> Self {
  type NoneAuthenticator (line 94) | pub struct NoneAuthenticator;
  type NoneAuthenticatorProvider (line 112) | pub struct NoneAuthenticatorProvider;
  function test_static_password_authenticator_new (line 129) | fn test_static_password_authenticator_new() {
  function test_static_password_authenticator_cassandra_name (line 134) | fn test_static_password_authenticator_cassandra_name() {
  function test_authenticator_none_cassandra_name (line 143) | fn test_authenticator_none_cassandra_name() {

FILE: cassandra-protocol/src/compression.rs
  type Result (line 18) | type Result<T> = result::Result<T, CompressionError>;
  constant LZ4 (line 20) | pub const LZ4: &str = "lz4";
  constant SNAPPY (line 21) | pub const SNAPPY: &str = "snappy";
  type CompressionError (line 26) | pub enum CompressionError {
    method fmt (line 34) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
  method source (line 43) | fn source(&self) -> Option<&(dyn Error + 'static)> {
  method clone (line 52) | fn clone(&self) -> Self {
  type Compression (line 68) | pub enum Compression {
    method encode (line 91) | pub fn encode(&self, bytes: &[u8]) -> Result<Vec<u8>> {
    method is_compressed (line 101) | pub fn is_compressed(self) -> bool {
    method decode (line 106) | pub fn decode(&self, bytes: Vec<u8>) -> Result<Vec<u8>> {
    method as_str (line 115) | pub fn as_str(&self) -> Option<&'static str> {
    method encode_snappy (line 123) | fn encode_snappy(bytes: &[u8]) -> Result<Vec<u8>> {
    method decode_snappy (line 130) | fn decode_snappy(bytes: Vec<u8>) -> Result<Vec<u8>> {
    method encode_lz4 (line 137) | fn encode_lz4(bytes: &[u8]) -> Result<Vec<u8>> {
    method decode_lz4 (line 153) | fn decode_lz4(bytes: Vec<u8>) -> Result<Vec<u8>> {
    method from (line 188) | fn from(compression_string: String) -> Compression {
    method to_protocol_string (line 196) | pub fn to_protocol_string(self) -> String {
    method from_protocol_string (line 204) | pub fn from_protocol_string(protocol_string: &str) -> std::result::Res...
    method from (line 217) | fn from(compression_str: &'a str) -> Compression {
  function test_compression_to_protocol_string (line 231) | fn test_compression_to_protocol_string() {
  function test_compression_from_protocol_str (line 243) | fn test_compression_from_protocol_str() {
  function test_compression_from_string (line 282) | fn test_compression_from_string() {
  function test_compression_encode_snappy (line 292) | fn test_compression_encode_snappy() {
  function test_compression_decode_snappy (line 301) | fn test_compression_decode_snappy() {
  function test_compression_encode_lz4 (line 309) | fn test_compression_encode_lz4() {
  function test_compression_decode_lz4 (line 318) | fn test_compression_decode_lz4() {
  function test_compression_encode_none (line 326) | fn test_compression_encode_none() {
  function test_compression_decode_none (line 335) | fn test_compression_decode_none() {
  function test_compression_decode_lz4_with_invalid_input (line 343) | fn test_compression_decode_lz4_with_invalid_input() {
  function test_compression_decode_lz4_short_input_is_error_not_panic (line 350) | fn test_compression_decode_lz4_short_input_is_error_not_panic() {
  function test_compression_decode_lz4_negative_size_is_error_not_oom (line 360) | fn test_compression_decode_lz4_negative_size_is_error_not_oom() {
  function test_compression_encode_snappy_with_non_utf8 (line 371) | fn test_compression_encode_snappy_with_non_utf8() {

FILE: cassandra-protocol/src/consistency.rs
  type Consistency (line 17) | pub enum Consistency {
    type Error (line 112) | type Error = error::Error;
    method try_from (line 114) | fn try_from(value: CIntShort) -> Result<Self, Self::Error> {
    method is_dc_local (line 167) | pub fn is_dc_local(self) -> bool {
  type Err (line 78) | type Err = error::Error;
  method from_str (line 80) | fn from_str(s: &str) -> Result<Self, Self::Err> {
  method serialize (line 105) | fn serialize(&self, cursor: &mut io::Cursor<&mut Vec<u8>>, version: Vers...
  method from (line 133) | fn from(value: Consistency) -> Self {
  method from_bytes (line 151) | fn from_bytes(bytes: &[u8]) -> error::Result<Consistency> {
  method from_cursor (line 159) | fn from_cursor(cursor: &mut io::Cursor<&[u8]>, version: Version) -> erro...
  function test_consistency_serialize (line 182) | fn test_consistency_serialize() {
  function test_consistency_from (line 209) | fn test_consistency_from() {
  function test_consistency_from_bytes (line 224) | fn test_consistency_from_bytes() {
  function test_consistency_from_cursor (line 261) | fn test_consistency_from_cursor() {

FILE: cassandra-protocol/src/crc.rs
  constant CRC24_POLY (line 3) | const CRC24_POLY: i32 = 0x1974f0b;
  constant CRC24_INIT (line 4) | const CRC24_INIT: i32 = 0x875060;
  function crc24 (line 7) | pub fn crc24(bytes: &[u8]) -> i32 {
  function crc32 (line 23) | pub fn crc32(bytes: &[u8]) -> u32 {

FILE: cassandra-protocol/src/error.rs
  type Result (line 14) | pub type Result<T> = result::Result<T, Error>;
  type Error (line 23) | pub enum Error {
    method from (line 105) | fn from(err: String) -> Error {
    method from (line 111) | fn from(err: &str) -> Error {
  function column_is_empty_err (line 100) | pub fn column_is_empty_err<T: Display>(column_name: T) -> Error {
  method clone (line 117) | fn clone(&self) -> Self {

FILE: cassandra-protocol/src/events.rs
  type ServerEvent (line 7) | pub type ServerEvent = MessageServerEvent;
  type SimpleServerEvent (line 11) | pub type SimpleServerEvent = MessageSimpleServerEvent;
  type SchemaChange (line 14) | pub type SchemaChange = MessageSchemaChange;

FILE: cassandra-protocol/src/frame.rs
  constant ENVELOPE_HEADER_LEN (line 17) | const ENVELOPE_HEADER_LEN: usize = 9;
  constant STREAM_LEN (line 19) | pub const STREAM_LEN: usize = 2;
  constant LENGTH_LEN (line 21) | pub const LENGTH_LEN: usize = 4;
  constant EVENT_STREAM_ID (line 48) | pub const EVENT_STREAM_ID: i16 = -1;
  function const_max (line 50) | const fn const_max(a: usize, b: usize) -> usize {
  constant PAYLOAD_SIZE_LIMIT (line 59) | pub const PAYLOAD_SIZE_LIMIT: usize = 1 << 17;
  constant UNCOMPRESSED_FRAME_HEADER_LENGTH (line 61) | const UNCOMPRESSED_FRAME_HEADER_LENGTH: usize = 6;
  constant COMPRESSED_FRAME_HEADER_LENGTH (line 62) | const COMPRESSED_FRAME_HEADER_LENGTH: usize = 8;
  constant FRAME_TRAILER_LENGTH (line 63) | const FRAME_TRAILER_LENGTH: usize = 4;
  constant MAX_FRAME_SIZE (line 66) | pub const MAX_FRAME_SIZE: usize = PAYLOAD_SIZE_LIMIT
  type StreamId (line 74) | pub type StreamId = i16;
  type ParsedEnvelope (line 77) | pub struct ParsedEnvelope {
  type Envelope (line 86) | pub struct Envelope {
    method new (line 101) | pub fn new(
    method request_body (line 124) | pub fn request_body(&self) -> error::Result<RequestBody> {
    method response_body (line 129) | pub fn response_body(&self) -> error::Result<ResponseBody> {
    method tracing_id (line 134) | pub fn tracing_id(&self) -> &Option<Uuid> {
    method warnings (line 139) | pub fn warnings(&self) -> &[String] {
    method from_buffer (line 149) | pub fn from_buffer(
    method check_envelope_size (line 221) | pub fn check_envelope_size(data: &[u8]) -> Result<usize, CheckEnvelope...
    method encode_with (line 237) | pub fn encode_with(&self, compressor: Compression) -> error::Result<Ve...
  type CheckEnvelopeSizeError (line 317) | pub enum CheckEnvelopeSizeError {
  type ParseEnvelopeError (line 328) | pub enum ParseEnvelopeError {
  type Version (line 348) | pub enum Version {
    type Error (line 365) | type Error = error::Error;
    method try_from (line 367) | fn try_from(version: u8) -> Result<Self, Self::Error> {
    constant BYTE_LENGTH (line 381) | pub const BYTE_LENGTH: usize = 1;
  function from (line 355) | fn from(value: Version) -> Self {
  type Direction (line 385) | pub enum Direction {
    method from (line 400) | fn from(value: u8) -> Self {
  function from (line 391) | fn from(value: Direction) -> u8 {
  method default (line 422) | fn default() -> Self {
  constant BYTE_LENGTH (line 429) | pub const BYTE_LENGTH: usize = 1;
  type Opcode (line 434) | pub enum Opcode {
    constant BYTE_LENGTH (line 455) | pub const BYTE_LENGTH: usize = 1;
    type Error (line 482) | type Error = error::Error;
    method try_from (line 484) | fn try_from(value: u8) -> Result<Self, <Opcode as TryFrom<u8>>::Error> {
  function from (line 459) | fn from(value: Opcode) -> Self {
  function test_encode_decode_roundtrip_response (line 511) | pub fn test_encode_decode_roundtrip_response(
  function test_encode_decode_roundtrip_request (line 542) | pub fn test_encode_decode_roundtrip_request(
  function test_encode_decode_roundtrip_nondeterministic_request (line 574) | pub fn test_encode_decode_roundtrip_nondeterministic_request(
  function test_frame_version_as_byte (line 608) | fn test_frame_version_as_byte() {
  function test_frame_version_from (line 618) | fn test_frame_version_from() {
  function test_opcode_as_byte (line 635) | fn test_opcode_as_byte() {
  function test_opcode_from (line 655) | fn test_opcode_from() {
  function test_ready (line 675) | fn test_ready() {
  function test_query_minimal (line 692) | fn test_query_minimal() {
  function test_query_simple_values (line 724) | fn test_query_simple_values() {
  function test_query_named_values (line 763) | fn test_query_named_values() {
  function test_result_prepared_statement (line 800) | fn test_result_prepared_statement() {
  function create_small_envelope_data (line 910) | fn create_small_envelope_data() -> (Envelope, Vec<u8>) {
  function create_large_envelope_data (line 932) | fn create_large_envelope_data() -> (Envelope, Vec<u8>) {
  function should_encode_and_decode_legacy_frames (line 953) | fn should_encode_and_decode_legacy_frames() {
  function should_encode_and_decode_uncompressed_self_contained_frames (line 976) | fn should_encode_and_decode_uncompressed_self_contained_frames() {
  function should_encode_and_decode_uncompressed_non_self_contained_frames (line 1004) | fn should_encode_and_decode_uncompressed_non_self_contained_frames() {
  function should_encode_and_decode_compressed_self_contained_frames (line 1040) | fn should_encode_and_decode_compressed_self_contained_frames() {
  function should_encode_and_decode_compressed_non_self_contained_frames (line 1068) | fn should_encode_and_decode_compressed_non_self_contained_frames() {
  function test_tracing_id_request (line 1113) | fn test_tracing_id_request() {
  function test_tracing_id_response (line 1151) | fn test_tracing_id_response() {
  function test_warnings_response (line 1180) | fn test_warnings_response() {

FILE: cassandra-protocol/src/frame/events.rs
  constant TOPOLOGY_CHANGE (line 12) | const TOPOLOGY_CHANGE: &str = "TOPOLOGY_CHANGE";
  constant STATUS_CHANGE (line 13) | const STATUS_CHANGE: &str = "STATUS_CHANGE";
  constant SCHEMA_CHANGE (line 14) | const SCHEMA_CHANGE: &str = "SCHEMA_CHANGE";
  constant NEW_NODE (line 17) | const NEW_NODE: &str = "NEW_NODE";
  constant REMOVED_NODE (line 18) | const REMOVED_NODE: &str = "REMOVED_NODE";
  constant UP (line 21) | const UP: &str = "UP";
  constant DOWN (line 22) | const DOWN: &str = "DOWN";
  constant CREATED (line 25) | const CREATED: &str = "CREATED";
  constant UPDATED (line 26) | const UPDATED: &str = "UPDATED";
  constant DROPPED (line 27) | const DROPPED: &str = "DROPPED";
  constant KEYSPACE (line 30) | const KEYSPACE: &str = "KEYSPACE";
  constant TABLE (line 31) | const TABLE: &str = "TABLE";
  constant TYPE (line 32) | const TYPE: &str = "TYPE";
  constant FUNCTION (line 33) | const FUNCTION: &str = "FUNCTION";
  constant AGGREGATE (line 34) | const AGGREGATE: &str = "AGGREGATE";
  type SimpleServerEvent (line 41) | pub enum SimpleServerEvent {
    method as_str (line 48) | pub fn as_str(&self) -> &'static str {
    method from (line 58) | fn from(event: ServerEvent) -> SimpleServerEvent {
    method from (line 68) | fn from(event: &'a ServerEvent) -> SimpleServerEvent {
    type Error (line 78) | type Error = error::Error;
    method try_from (line 80) | fn try_from(value: &str) -> Result<Self, Self::Error> {
    method eq (line 91) | fn eq(&self, full_event: &ServerEvent) -> bool {
  type ServerEvent (line 99) | pub enum ServerEvent {
    method eq (line 128) | fn eq(&self, event: &SimpleServerEvent) -> bool {
  method serialize (line 109) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 134) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  type TopologyChange (line 153) | pub struct TopologyChange {
  method serialize (line 160) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 167) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  type TopologyChangeType (line 177) | pub enum TopologyChangeType {
  method serialize (line 183) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 192) | fn from_cursor(
  type StatusChange (line 206) | pub struct StatusChange {
  method serialize (line 213) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 220) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  type StatusChangeType (line 230) | pub enum StatusChangeType {
  method serialize (line 236) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 245) | fn from_cursor(
  type SchemaChange (line 259) | pub struct SchemaChange {
  method serialize (line 266) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 274) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  type SchemaChangeType (line 290) | pub enum SchemaChangeType {
  method serialize (line 297) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 307) | fn from_cursor(
  type SchemaChangeTarget (line 323) | pub enum SchemaChangeTarget {
  method serialize (line 332) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 344) | fn from_cursor(
  type SchemaChangeOptions (line 362) | pub enum SchemaChangeOptions {
    method from_cursor_and_target (line 397) | fn from_cursor_and_target(
    method from_cursor_keyspace (line 412) | fn from_cursor_keyspace(cursor: &mut Cursor<&[u8]>) -> error::Result<S...
    method from_cursor_table_type (line 418) | fn from_cursor_table_type(cursor: &mut Cursor<&[u8]>) -> error::Result...
    method from_cursor_function_aggregate (line 424) | fn from_cursor_function_aggregate(
  method serialize (line 375) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  function test_encode_decode (line 437) | fn test_encode_decode(bytes: &[u8], expected: ServerEvent) {
  function from_cursor (line 455) | fn from_cursor() {
  function serialize (line 472) | fn serialize() {
  function from_cursor_wrong (line 494) | fn from_cursor_wrong() {
  function from_cursor (line 508) | fn from_cursor() {
  function serialize (line 525) | fn serialize() {
  function from_cursor_wrong (line 546) | fn from_cursor_wrong() {
  function from_cursor (line 562) | fn from_cursor() {
  function serialize (line 586) | fn serialize() {
  function from_cursor_wrong (line 616) | fn from_cursor_wrong() {
  function schema_change_target (line 631) | fn schema_change_target() {
  function serialize (line 671) | fn serialize() {
  function from_cursor_wrong (line 720) | fn from_cursor_wrong() {
  function topology_change_new_node (line 732) | fn topology_change_new_node() {
  function topology_change_removed_node (line 749) | fn topology_change_removed_node() {
  function status_change_up (line 767) | fn status_change_up() {
  function status_change_down (line 784) | fn status_change_down() {
  function schema_change_created (line 801) | fn schema_change_created() {
  function schema_change_updated (line 910) | fn schema_change_updated() {
  function schema_change_dropped (line 1018) | fn schema_change_dropped() {

FILE: cassandra-protocol/src/frame/frame_decoder.rs
  function create_unexpected_self_contained_error (line 13) | fn create_unexpected_self_contained_error() -> Error {
  function create_header_crc_mismatch_error (line 18) | fn create_header_crc_mismatch_error(computed_crc: i32, header_crc24: i32...
  function create_payload_crc_mismatch_error (line 23) | fn create_payload_crc_mismatch_error(computed_crc: u32, payload_crc32: u...
  function extract_envelopes (line 27) | fn extract_envelopes(buffer: &[u8], compression: Compression) -> Result<...
  function try_decode_envelopes_with_spare_data (line 45) | fn try_decode_envelopes_with_spare_data(
  function try_decode_envelopes_without_spare_data (line 53) | fn try_decode_envelopes_without_spare_data(buffer: &[u8]) -> Result<Vec<...
  type FrameDecoder (line 60) | pub trait FrameDecoder {
    method consume (line 64) | fn consume(&mut self, data: &mut Vec<u8>, compression: Compression) ->...
    method consume (line 82) | fn consume(&mut self, data: &mut Vec<u8>, compression: Compression) ->...
    method consume (line 112) | fn consume(&mut self, data: &mut Vec<u8>, _compression: Compression) -...
    method consume (line 191) | fn consume(&mut self, data: &mut Vec<u8>, _compression: Compression) -...
  type LegacyFrameDecoder (line 69) | pub struct LegacyFrameDecoder {
  method default (line 74) | fn default() -> Self {
  type Lz4FrameDecoder (line 105) | pub struct Lz4FrameDecoder {
    method try_decode_frame (line 118) | fn try_decode_frame(buffer: &mut Vec<u8>) -> Result<Option<(bool, Vec<...
  type UncompressedFrameDecoder (line 184) | pub struct UncompressedFrameDecoder {
    method try_decode_frame (line 197) | fn try_decode_frame(buffer: &mut Vec<u8>) -> Result<Option<(bool, Vec<...
  type GenericFrameDecoder (line 252) | struct GenericFrameDecoder {
    method extract_non_self_contained_envelopes (line 269) | fn extract_non_self_contained_envelopes(&mut self) -> Result<Vec<Envel...
    method extract_expected_payload_len (line 310) | fn extract_expected_payload_len(&self) -> Option<usize> {
    method handle_frame (line 318) | fn handle_frame(
    method consume (line 338) | fn consume(
  method default (line 259) | fn default() -> Self {
  function make_envelope (line 382) | fn make_envelope(stream_id: i16, fill: u8, body_size: usize) -> Vec<u8> {
  function encode_as_non_self_contained (line 400) | fn encode_as_non_self_contained(envelope: &[u8]) -> Vec<u8> {
  function decoder_recovers_two_consecutive_non_self_contained_envelopes (line 414) | fn decoder_recovers_two_consecutive_non_self_contained_envelopes() {
  function decoder_preserves_trailing_bytes_across_non_self_contained_frames (line 451) | fn decoder_preserves_trailing_bytes_across_non_self_contained_frames() {

FILE: cassandra-protocol/src/frame/frame_encoder.rs
  function put3b (line 10) | fn put3b(buffer: &mut [u8], value: i32) {
  function add_trailer (line 18) | fn add_trailer(buffer: &mut Vec<u8>, payload_start: usize) {
  type FrameEncoder (line 40) | pub trait FrameEncoder {
    method can_fit (line 42) | fn can_fit(&self, len: usize) -> bool;
    method reset (line 45) | fn reset(&mut self);
    method add_envelope (line 48) | fn add_envelope(&mut self, envelope: Vec<u8>);
    method finalize_self_contained (line 51) | fn finalize_self_contained(&mut self) -> &[u8];
    method finalize_non_self_contained (line 55) | fn finalize_non_self_contained(&mut self, envelope: &[u8]) -> (usize, ...
    method has_envelopes (line 58) | fn has_envelopes(&self) -> bool;
    method can_fit (line 69) | fn can_fit(&self, _len: usize) -> bool {
    method reset (line 75) | fn reset(&mut self) {
    method add_envelope (line 80) | fn add_envelope(&mut self, envelope: Vec<u8>) {
    method finalize_self_contained (line 85) | fn finalize_self_contained(&mut self) -> &[u8] {
    method finalize_non_self_contained (line 90) | fn finalize_non_self_contained(&mut self, envelope: &[u8]) -> (usize, ...
    method has_envelopes (line 102) | fn has_envelopes(&self) -> bool {
    method can_fit (line 115) | fn can_fit(&self, len: usize) -> bool {
    method reset (line 121) | fn reset(&mut self) {
    method add_envelope (line 126) | fn add_envelope(&mut self, mut envelope: Vec<u8>) {
    method finalize_self_contained (line 130) | fn finalize_self_contained(&mut self) -> &[u8] {
    method finalize_non_self_contained (line 137) | fn finalize_non_self_contained(&mut self, envelope: &[u8]) -> (usize, ...
    method has_envelopes (line 150) | fn has_envelopes(&self) -> bool {
    method can_fit (line 190) | fn can_fit(&self, len: usize) -> bool {
    method reset (line 199) | fn reset(&mut self) {
    method add_envelope (line 204) | fn add_envelope(&mut self, mut envelope: Vec<u8>) {
    method finalize_self_contained (line 208) | fn finalize_self_contained(&mut self) -> &[u8] {
    method finalize_non_self_contained (line 221) | fn finalize_non_self_contained(&mut self, envelope: &[u8]) -> (usize, ...
    method has_envelopes (line 259) | fn has_envelopes(&self) -> bool {
  type LegacyFrameEncoder (line 63) | pub struct LegacyFrameEncoder {
  type UncompressedFrameEncoder (line 109) | pub struct UncompressedFrameEncoder {
    method write_header (line 163) | fn write_header(&mut self, self_contained: bool) {
  method default (line 156) | fn default() -> Self {
  type Lz4FrameEncoder (line 184) | pub struct Lz4FrameEncoder {
    method write_header (line 272) | fn write_header(&mut self, uncompressed_size: usize, self_contained: b...
  method default (line 265) | fn default() -> Self {

FILE: cassandra-protocol/src/frame/message_auth_challenge.rs
  type BodyResAuthChallenge (line 9) | pub struct BodyResAuthChallenge {
  method serialize (line 14) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 20) | fn from_cursor(
  function body_res_auth_challenge_from_cursor (line 35) | fn body_res_auth_challenge_from_cursor() {

FILE: cassandra-protocol/src/frame/message_auth_response.rs
  type BodyReqAuthResponse (line 8) | pub struct BodyReqAuthResponse {
  method serialize (line 14) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 20) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  method new_req_auth_response (line 27) | pub fn new_req_auth_response(token_bytes: CBytes, version: Version) -> E...
  function body_req_auth_response (line 51) | fn body_req_auth_response() {
  function frame_body_req_auth_response (line 61) | fn frame_body_req_auth_response() {

FILE: cassandra-protocol/src/frame/message_auth_success.rs
  type BodyReqAuthSuccess (line 9) | pub struct BodyReqAuthSuccess {
  method serialize (line 14) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 20) | fn from_cursor(
  function body_req_auth_success (line 35) | fn body_req_auth_success() {

FILE: cassandra-protocol/src/frame/message_authenticate.rs
  type BodyResAuthenticate (line 9) | pub struct BodyResAuthenticate {
  method serialize (line 14) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 20) | fn from_cursor(
  function body_res_authenticate (line 38) | fn body_res_authenticate() {

FILE: cassandra-protocol/src/frame/message_batch.rs
  type BodyReqBatch (line 16) | pub struct BodyReqBatch {
  method serialize (line 27) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 80) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  type BatchType (line 134) | pub enum BatchType {
    type Error (line 146) | type Error = Error;
    method try_from (line 148) | fn try_from(value: u8) -> Result<Self, Self::Error> {
  function from (line 159) | fn from(value: BatchType) -> Self {
  type BatchQuerySubj (line 170) | pub enum BatchQuerySubj {
  type BatchQuery (line 177) | pub struct BatchQuery {
  method serialize (line 189) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 209) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  method new_req_batch (line 235) | pub fn new_req_batch(query: BodyReqBatch, flags: Flags, version: Version...
  function should_deserialize_query (line 263) | fn should_deserialize_query() {
  function should_deserialize_body (line 273) | fn should_deserialize_body() {
  function should_support_keyspace (line 286) | fn should_support_keyspace() {
  function should_support_now_in_seconds (line 305) | fn should_support_now_in_seconds() {

FILE: cassandra-protocol/src/frame/message_error.rs
  type ErrorBody (line 18) | pub struct ErrorBody {
    method is_bad_protocol (line 46) | pub fn is_bad_protocol(&self) -> bool {
  method serialize (line 26) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 34) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  type FailureInfo (line 60) | pub enum FailureInfo {
  method serialize (line 68) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 85) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  type ErrorType (line 108) | pub enum ErrorType {
    method from_cursor_with_code (line 148) | pub fn from_cursor_with_code(
    method to_error_code (line 180) | pub fn to_error_code(&self) -> CInt {
  method serialize (line 130) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  type UnavailableError (line 207) | pub struct UnavailableError {
  method serialize (line 217) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 225) | fn from_cursor(
  type WriteTimeoutError (line 243) | pub struct WriteTimeoutError {
  method serialize (line 258) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 271) | fn from_cursor(
  type ReadTimeoutError (line 297) | pub struct ReadTimeoutError {
    method replica_has_responded (line 319) | pub fn replica_has_responded(&self) -> bool {
  method serialize (line 308) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 325) | fn from_cursor(
  type ReadFailureError (line 349) | pub struct ReadFailureError {
    method replica_has_responded (line 374) | pub fn replica_has_responded(&self) -> bool {
  method serialize (line 362) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 380) | fn from_cursor(
  type FunctionFailureError (line 406) | pub struct FunctionFailureError {
  method serialize (line 416) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 424) | fn from_cursor(
  type WriteFailureError (line 442) | pub struct WriteFailureError {
  method serialize (line 456) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 466) | fn from_cursor(
  type WriteType (line 490) | pub enum WriteType {
  method serialize (line 516) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 532) | fn from_cursor(cursor: &mut Cursor<&[u8]>, _version: Version) -> error::...
  type AlreadyExistsError (line 550) | pub struct AlreadyExistsError {
  method serialize (line 559) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 566) | fn from_cursor(
  type UnpreparedError (line 581) | pub struct UnpreparedError {
  method serialize (line 587) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 593) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  function test_encode_decode (line 601) | fn test_encode_decode(bytes: &[u8], expected: ErrorBody) {
  function server (line 621) | fn server() {
  function protocol (line 634) | fn protocol() {
  function authentication (line 647) | fn authentication() {
  function unavailable (line 660) | fn unavailable() {
  function overloaded (line 682) | fn overloaded() {
  function is_bootstrapping (line 695) | fn is_bootstrapping() {
  function truncate (line 708) | fn truncate() {
  function write_timeout (line 721) | fn write_timeout() {
  function read_timeout (line 746) | fn read_timeout() {
  function read_failure (line 770) | fn read_failure() {
  function syntax (line 796) | fn syntax() {
  function unauthorized (line 809) | fn unauthorized() {
  function invalid (line 822) | fn invalid() {
  function config (line 835) | fn config() {

FILE: cassandra-protocol/src/frame/message_event.rs
  type BodyResEvent (line 8) | pub struct BodyResEvent {
  method serialize (line 13) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 19) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  function body_res_event (line 33) | fn body_res_event() {

FILE: cassandra-protocol/src/frame/message_execute.rs
  type BodyReqExecute (line 10) | pub struct BodyReqExecute<'a> {
  method serialize (line 17) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method serialize_to_vec (line 28) | fn serialize_to_vec(&self, version: Version) -> Vec<u8> {
  type BodyReqExecuteOwned (line 44) | pub struct BodyReqExecuteOwned {
  method from_cursor (line 51) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  method serialize (line 71) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method new_req_execute (line 82) | pub fn new_req_execute(
  function should_deserialize_body (line 118) | fn should_deserialize_body() {
  function should_support_result_metadata_id (line 128) | fn should_support_result_metadata_id() {

FILE: cassandra-protocol/src/frame/message_options.rs
  type BodyReqOptions (line 7) | pub struct BodyReqOptions;
  method serialize (line 11) | fn serialize(&self, _cursor: &mut Cursor<&mut Vec<u8>>, _version: Versio...
  method from_cursor (line 16) | fn from_cursor(_cursor: &mut Cursor<&[u8]>, _version: Version) -> error:...
  method new_req_options (line 23) | pub fn new_req_options(version: Version) -> Envelope {
  function test_frame_options (line 46) | fn test_frame_options() {

FILE: cassandra-protocol/src/frame/message_prepare.rs
  type BodyReqPrepare (line 11) | pub struct BodyReqPrepare {
    method new (line 19) | pub fn new(query: String, keyspace: Option<String>) -> BodyReqPrepare {
  method serialize (line 26) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method serialize_to_vec (line 40) | fn serialize_to_vec(&self, version: Version) -> Vec<u8> {
  method from_cursor (line 62) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  method new_req_prepare (line 84) | pub fn new_req_prepare(
  function should_deserialize_body (line 114) | fn should_deserialize_body() {
  function should_support_keyspace (line 123) | fn should_support_keyspace() {

FILE: cassandra-protocol/src/frame/message_query.rs
  type BodyReqQuery (line 11) | pub struct BodyReqQuery {
    method new (line 20) | fn new(
  method from_cursor (line 50) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  method serialize (line 63) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method serialize_to_vec (line 69) | fn serialize_to_vec(&self, version: Version) -> Vec<u8> {
  method new_req_query (line 79) | pub fn new_req_query(
  method new_query (line 121) | pub fn new_query(query: BodyReqQuery, flags: Flags, version: Version) ->...

FILE: cassandra-protocol/src/frame/message_ready.rs
  type BodyResReady (line 6) | pub struct BodyResReady;
  method serialize (line 10) | fn serialize(&self, _cursor: &mut Cursor<&mut Vec<u8>>, _version: Versio...
  method from_cursor (line 15) | fn from_cursor(_cursor: &mut Cursor<&[u8]>, _version: Version) -> error:...
  function body_res_ready_new (line 25) | fn body_res_ready_new() {
  function body_res_ready_serialize (line 31) | fn body_res_ready_serialize() {

FILE: cassandra-protocol/src/frame/message_register.rs
  type BodyReqRegister (line 12) | pub struct BodyReqRegister {
  method serialize (line 17) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 24) | fn from_cursor(cursor: &mut Cursor<&[u8]>, _version: Version) -> error::...
  method new_req_register (line 36) | pub fn new_req_register(events: Vec<SimpleServerEvent>, version: Version...
  function should_deserialize_body (line 62) | fn should_deserialize_body() {

FILE: cassandra-protocol/src/frame/message_request.rs
  type RequestBody (line 17) | pub enum RequestBody {
    method try_from (line 44) | pub fn try_from(
  method serialize (line 29) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {

FILE: cassandra-protocol/src/frame/message_response.rs
  type ResponseBody (line 18) | pub enum ResponseBody {
    method try_from (line 63) | pub fn try_from(
    method into_rows (line 92) | pub fn into_rows(self) -> Option<Vec<Row>> {
    method as_rows_metadata (line 99) | pub fn as_rows_metadata(&self) -> Option<&RowsMetadata> {
    method as_cols (line 106) | pub fn as_cols(&self) -> Option<&BodyResResultRows> {
    method into_prepared (line 115) | pub fn into_prepared(self) -> Option<BodyResResultPrepared> {
    method into_set_keyspace (line 124) | pub fn into_set_keyspace(self) -> Option<BodyResResultSetKeyspace> {
    method into_server_event (line 132) | pub fn into_server_event(self) -> Option<BodyResEvent> {
    method authenticator (line 139) | pub fn authenticator(&self) -> Option<&str> {
    method into_error (line 146) | pub fn into_error(self) -> Option<ErrorBody> {
  method serialize (line 34) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {

FILE: cassandra-protocol/src/frame/message_result.rs
  type ResultKind (line 18) | pub enum ResultKind {
    type Error (line 59) | type Error = Error;
    method try_from (line 61) | fn try_from(value: CInt) -> Result<Self, Self::Error> {
  method serialize (line 33) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_bytes (line 39) | fn from_bytes(bytes: &[u8]) -> error::Result<ResultKind> {
  method from (line 47) | fn from(value: ResultKind) -> Self {
  method from_cursor (line 74) | fn from_cursor(cursor: &mut Cursor<&[u8]>, _version: Version) -> error::...
  type ResResultBody (line 87) | pub enum ResResultBody {
    method parse_body_from_cursor (line 129) | fn parse_body_from_cursor(
    method into_rows (line 152) | pub fn into_rows(self) -> Option<Vec<Row>> {
    method as_rows_metadata (line 160) | pub fn as_rows_metadata(&self) -> Option<&RowsMetadata> {
    method into_prepared (line 169) | pub fn into_prepared(self) -> Option<BodyResResultPrepared> {
    method into_set_keyspace (line 178) | pub fn into_set_keyspace(self) -> Option<BodyResResultSetKeyspace> {
    method from_cursor (line 187) | pub fn from_cursor(
  method serialize (line 103) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  type BodyResResultSetKeyspace (line 198) | pub struct BodyResResultSetKeyspace {
  method serialize (line 205) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 211) | fn from_cursor(
  type BodyResResultRows (line 222) | pub struct BodyResResultRows {
    method rows_content (line 246) | fn rows_content(
  method serialize (line 235) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 263) | fn from_cursor(
  type RowsMetadata (line 283) | pub struct RowsMetadata {
  method serialize (line 303) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 351) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  method serialize (line 408) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  function from (line 414) | fn from(value: RowsMetadataFlags) -> Self {
  method from_bytes (line 420) | fn from_bytes(bytes: &[u8]) -> error::Result<RowsMetadataFlags> {
  type TableSpec (line 430) | pub struct TableSpec {
  method serialize (line 437) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 444) | fn from_cursor(cursor: &mut Cursor<&[u8]>, _version: Version) -> error::...
  type ColSpec (line 456) | pub struct ColSpec {
    method parse_colspecs (line 479) | pub fn parse_colspecs(
  method serialize (line 468) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  type ColType (line 509) | pub enum ColType {
    type Error (line 539) | type Error = Error;
    method try_from (line 541) | fn try_from(value: CIntShort) -> Result<Self, Self::Error> {
  method from_bytes (line 576) | fn from_bytes(bytes: &[u8]) -> error::Result<ColType> {
  method serialize (line 585) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 619) | fn from_cursor(cursor: &mut Cursor<&[u8]>, _version: Version) -> error::...
  type ColTypeOption (line 630) | pub struct ColTypeOption {
  method serialize (line 639) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 648) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  type ColTypeOptionValue (line 686) | pub enum ColTypeOptionValue {
  method serialize (line 698) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  type CUdt (line 716) | pub struct CUdt {
  method serialize (line 727) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 739) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  type CTuple (line 765) | pub struct CTuple {
  method serialize (line 772) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 779) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  type BodyResResultPrepared (line 796) | pub struct BodyResResultPrepared {
    method from_cursor (line 823) | fn from_cursor(
  method serialize (line 810) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method serialize (line 855) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  type PreparedMetadata (line 862) | pub struct PreparedMetadata {
    method from_cursor (line 899) | fn from_cursor(
  method serialize (line 870) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  function extract_global_table_space (line 936) | fn extract_global_table_space(
  function test_encode_decode (line 950) | fn test_encode_decode(bytes: &[u8], expected: ResResultBody) {
  function cudt (line 971) | fn cudt() {
  function ctuple (line 1026) | fn ctuple() {
  function col_spec_with_table_spec (line 1059) | fn col_spec_with_table_spec() {
  function col_spec_without_table_spec (line 1097) | fn col_spec_without_table_spec() {
  function col_type_options_int (line 1133) | fn col_type_options_int() {
  function col_type_options_map (line 1155) | fn col_type_options_map() {
  function table_spec (line 1192) | fn table_spec() {
  function test_void (line 1222) | fn test_void() {
  function rows_metadata (line 1235) | fn rows_metadata() {
  function test_rows (line 1308) | fn test_rows() {
  function test_rows_no_metadata (line 1369) | fn test_rows_no_metadata() {
  function test_set_keyspace (line 1400) | fn test_set_keyspace() {
  function prepared_metadata (line 1420) | fn prepared_metadata() {
  function test_prepared (line 1492) | fn test_prepared() {
  function test_schema_change (line 1603) | fn test_schema_change() {

FILE: cassandra-protocol/src/frame/message_startup.rs
  constant CQL_VERSION (line 7) | const CQL_VERSION: &str = "CQL_VERSION";
  constant CQL_VERSION_VAL (line 8) | const CQL_VERSION_VAL: &str = "3.0.0";
  constant COMPRESSION (line 9) | const COMPRESSION: &str = "COMPRESSION";
  constant DRIVER_NAME (line 10) | const DRIVER_NAME: &str = "DRIVER_NAME";
  constant DRIVER_VERSION (line 11) | const DRIVER_VERSION: &str = "DRIVER_VERSION";
  type BodyReqStartup (line 14) | pub struct BodyReqStartup {
    method new (line 19) | pub fn new(compression: Option<String>, version: Version) -> BodyReqSt...
  method serialize (line 38) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 50) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...
  method new_req_startup (line 67) | pub fn new_req_startup(compression: Option<String>, version: Version) ->...
  function new_body_req_startup_some_compression (line 91) | fn new_body_req_startup_some_compression() {
  function new_body_req_startup_none_compression (line 106) | fn new_body_req_startup_none_compression() {
  function new_req_startup (line 116) | fn new_req_startup() {
  function body_req_startup_from_cursor (line 127) | fn body_req_startup_from_cursor() {

FILE: cassandra-protocol/src/frame/message_supported.rs
  type BodyResSupported (line 9) | pub struct BodyResSupported {
  method serialize (line 14) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 27) | fn from_cursor(
  function body_res_supported (line 54) | fn body_res_supported() {

FILE: cassandra-protocol/src/frame/traits.rs
  type Serialize (line 8) | pub trait Serialize {
    method serialize (line 10) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version);
    method serialize_to_vec (line 13) | fn serialize_to_vec(&self, version: Version) -> Vec<u8> {
    method serialize (line 52) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, _version: Versi...
    method serialize (line 59) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, _version: Versi...
    method serialize (line 66) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, _version: Versi...
    method serialize (line 73) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, _version: Versi...
  type FromBytes (line 22) | pub trait FromBytes {
    method from_bytes (line 24) | fn from_bytes(bytes: &[u8]) -> error::Result<Self>
  type FromCursor (line 31) | pub trait FromCursor {
    method from_cursor (line 33) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error:...
  type IntoQueryValues (line 39) | pub trait IntoQueryValues {
    method into_query_values (line 40) | fn into_query_values(self) -> query::QueryValues;
  type TryFromRow (line 43) | pub trait TryFromRow: Sized {
    method try_from_row (line 44) | fn try_from_row(row: crate::types::rows::Row) -> error::Result<Self>;
  type TryFromUdt (line 47) | pub trait TryFromUdt: Sized {
    method try_from_udt (line 48) | fn try_from_udt(udt: crate::types::udt::Udt) -> error::Result<Self>;

FILE: cassandra-protocol/src/lib.rs
  type Error (line 21) | pub type Error = error::Error;
  type Result (line 22) | pub type Result<T> = error::Result<T>;

FILE: cassandra-protocol/src/query/batch_query_builder.rs
  type QueryBatchPreparedStatement (line 11) | pub struct QueryBatchPreparedStatement {
  type QueryBatch (line 17) | pub struct QueryBatch {
  type BatchQueryBuilder (line 24) | pub struct BatchQueryBuilder {
    method new (line 51) | pub fn new() -> BatchQueryBuilder {
    method with_batch_type (line 56) | pub fn with_batch_type(mut self, batch_type: BatchType) -> Self {
    method add_query (line 63) | pub fn add_query<T: Into<String>>(mut self, query: T, values: QueryVal...
    method add_query_prepared (line 73) | pub fn add_query_prepared(mut self, query: &PreparedQuery, values: Que...
    method clear_queries (line 87) | pub fn clear_queries(mut self) -> Self {
    method with_consistency (line 93) | pub fn with_consistency(mut self, consistency: Consistency) -> Self {
    method with_serial_consistency (line 99) | pub fn with_serial_consistency(mut self, serial_consistency: Consisten...
    method with_timestamp (line 105) | pub fn with_timestamp(mut self, timestamp: CLong) -> Self {
    method with_keyspace (line 111) | pub fn with_keyspace(mut self, keyspace: String) -> Self {
    method with_now_in_seconds (line 117) | pub fn with_now_in_seconds(mut self, now_in_seconds: CInt) -> Self {
    method build (line 122) | pub fn build(self) -> CResult<QueryBatch> {
  method default (line 36) | fn default() -> Self {

FILE: cassandra-protocol/src/query/prepare_flags.rs
  method default (line 17) | fn default() -> Self {
  method serialize (line 24) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 30) | fn from_cursor(cursor: &mut Cursor<&[u8]>, _version: Version) -> Result<...

FILE: cassandra-protocol/src/query/prepared_query.rs
  type PreparedQuery (line 8) | pub struct PreparedQuery {
  method clone (line 17) | fn clone(&self) -> Self {
  method eq (line 30) | fn eq(&self, other: &Self) -> bool {
  method partial_cmp (line 39) | fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
  method cmp (line 46) | fn cmp(&self, other: &Self) -> Ordering {
  method hash (line 59) | fn hash<H: Hasher>(&self, state: &mut H) {

FILE: cassandra-protocol/src/query/query_flags.rs
  method default (line 34) | fn default() -> Self {
  method serialize (line 40) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 50) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> error::R...

FILE: cassandra-protocol/src/query/query_params.rs
  type QueryParams (line 15) | pub struct QueryParams {
    method flags (line 39) | fn flags(&self) -> QueryFlags {
  method serialize (line 79) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 124) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> Result<Q...

FILE: cassandra-protocol/src/query/query_params_builder.rs
  type QueryParamsBuilder (line 6) | pub struct QueryParamsBuilder {
    method new (line 21) | pub fn new() -> QueryParamsBuilder {
    method with_consistency (line 27) | pub fn with_consistency(mut self, consistency: Consistency) -> Self {
    method with_flags (line 34) | pub fn with_flags(mut self, flags: QueryFlags) -> Self {
    method with_values (line 41) | pub fn with_values(mut self, values: QueryValues) -> Self {
    method with_names (line 57) | pub fn with_names(mut self, with_names: bool) -> Self {
    method with_page_size (line 64) | pub fn with_page_size(mut self, size: CInt) -> Self {
    method with_paging_state (line 73) | pub fn with_paging_state(mut self, state: CBytes) -> Self {
    method with_serial_consistency (line 82) | pub fn with_serial_consistency(mut self, serial_consistency: Consisten...
    method with_timestamp (line 89) | pub fn with_timestamp(mut self, timestamp: CLong) -> Self {
    method with_keyspace (line 96) | pub fn with_keyspace(mut self, keyspace: String) -> Self {
    method with_now_in_seconds (line 103) | pub fn with_now_in_seconds(mut self, now_in_seconds: CInt) -> Self {
    method build (line 110) | pub fn build(self) -> QueryParams {

FILE: cassandra-protocol/src/query/query_values.rs
  type QueryValues (line 13) | pub enum QueryValues {
    method has_names (line 21) | pub fn has_names(&self) -> bool {
    method len (line 26) | pub fn len(&self) -> usize {
    method is_empty (line 34) | pub fn is_empty(&self) -> bool {
    method from (line 41) | fn from(values: Vec<T>) -> QueryValues {
    method from (line 49) | fn from(values: &[T]) -> QueryValues {
    method from (line 57) | fn from(values: HashMap<S, V>) -> QueryValues {
  method serialize (line 68) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {

FILE: cassandra-protocol/src/query/utils.rs
  function quote (line 3) | pub fn quote(text: &str) -> String {

FILE: cassandra-protocol/src/token.rs
  constant C1 (line 8) | const C1: Wrapping<i64> = Wrapping(0x87c3_7b91_1142_53d5_u64 as i64);
  constant C2 (line 9) | const C2: Wrapping<i64> = Wrapping(0x4cf5_ad43_2745_937f_u64 as i64);
  type Murmur3Token (line 13) | pub struct Murmur3Token {
    method generate (line 19) | pub fn generate(mut routing_key: &[u8]) -> Self {
    type Error (line 91) | type Error = Error;
    method try_from (line 93) | fn try_from(value: String) -> Result<Self, Self::Error> {
    method from (line 102) | fn from(value: i64) -> Self {
  function rotl64 (line 108) | fn rotl64(v: Wrapping<i64>, n: u32) -> Wrapping<i64> {
  function fmix (line 113) | fn fmix(mut k: Wrapping<i64>) -> Wrapping<i64> {
  function test_generate_murmur3_token (line 128) | fn test_generate_murmur3_token() {

FILE: cassandra-protocol/src/types.rs
  constant SHORT_LEN (line 12) | pub const SHORT_LEN: usize = 2;
  constant INT_LEN (line 13) | pub const INT_LEN: usize = 4;
  constant LONG_LEN (line 14) | pub const LONG_LEN: usize = 8;
  constant UUID_LEN (line 15) | pub const UUID_LEN: usize = 16;
  constant NULL_INT_LEN (line 17) | const NULL_INT_LEN: CInt = -1;
  constant NULL_SHORT_LEN (line 18) | const NULL_SHORT_LEN: CIntShort = -1;
  type AsCassandraType (line 50) | pub trait AsCassandraType {
    method as_cassandra_type (line 51) | fn as_cassandra_type(&self) -> CDRSResult<Option<CassandraType>>;
  type AsRustType (line 55) | pub trait AsRustType<T> {
    method as_rust_type (line 56) | fn as_rust_type(&self) -> CDRSResult<Option<T>>;
    method as_r_type (line 58) | fn as_r_type(&self) -> CDRSResult<T> {
  type AsRust (line 64) | pub trait AsRust {
    method as_rust (line 65) | fn as_rust<R>(&self) -> CDRSResult<Option<R>>
    method as_r_rust (line 72) | fn as_r_rust<T>(&self) -> CDRSResult<T>
  type IntoRustByName (line 82) | pub trait IntoRustByName<R> {
    method get_by_name (line 83) | fn get_by_name(&self, name: &str) -> CDRSResult<Option<R>>;
    method get_r_by_name (line 85) | fn get_r_by_name(&self, name: &str) -> CDRSResult<R> {
  type ByName (line 91) | pub trait ByName {
    method by_name (line 92) | fn by_name<R>(&self, name: &str) -> CDRSResult<Option<R>>
    method r_by_name (line 99) | fn r_by_name<R>(&self, name: &str) -> CDRSResult<R>
  type IntoRustByIndex (line 109) | pub trait IntoRustByIndex<R> {
    method get_by_index (line 110) | fn get_by_index(&self, index: usize) -> CDRSResult<Option<R>>;
    method get_r_by_index (line 112) | fn get_r_by_index(&self, index: usize) -> CDRSResult<R> {
  type ByIndex (line 118) | pub trait ByIndex {
    method by_index (line 119) | fn by_index<R>(&self, index: usize) -> CDRSResult<Option<R>>
    method r_by_index (line 126) | fn r_by_index<R>(&self, index: usize) -> CDRSResult<R>
  function convert_to_array (line 136) | fn convert_to_array<const S: usize>(bytes: &[u8]) -> Result<[u8; S], io:...
  function try_u64_from_bytes (line 143) | pub fn try_u64_from_bytes(bytes: &[u8]) -> Result<u64, io::Error> {
  function try_i64_from_bytes (line 148) | pub fn try_i64_from_bytes(bytes: &[u8]) -> Result<i64, io::Error> {
  function try_i32_from_bytes (line 153) | pub fn try_i32_from_bytes(bytes: &[u8]) -> Result<i32, io::Error> {
  function try_i16_from_bytes (line 158) | pub fn try_i16_from_bytes(bytes: &[u8]) -> Result<i16, io::Error> {
  function try_f32_from_bytes (line 163) | pub fn try_f32_from_bytes(bytes: &[u8]) -> Result<f32, io::Error> {
  function try_f64_from_bytes (line 168) | pub fn try_f64_from_bytes(bytes: &[u8]) -> Result<f64, io::Error> {
  function u16_from_bytes (line 173) | pub fn u16_from_bytes(bytes: [u8; 2]) -> u16 {
  function to_short (line 178) | pub fn to_short(int: i16) -> Vec<u8> {
  function to_int (line 183) | pub fn to_int(int: i32) -> Vec<u8> {
  function to_bigint (line 188) | pub fn to_bigint(int: i64) -> Vec<u8> {
  function to_u_short (line 193) | pub fn to_u_short(int: u16) -> Vec<u8> {
  function to_u_int (line 198) | pub fn to_u_int(int: u32) -> Vec<u8> {
  function to_u_big (line 203) | pub fn to_u_big(int: u64) -> Vec<u8> {
  function to_float (line 208) | pub fn to_float(f: f32) -> Vec<u8> {
  function to_float_big (line 213) | pub fn to_float_big(f: f64) -> Vec<u8> {
  function serialize_str (line 217) | pub fn serialize_str(cursor: &mut Cursor<&mut Vec<u8>>, value: &str, ver...
  function serialize_str_long (line 223) | pub(crate) fn serialize_str_long(cursor: &mut Cursor<&mut Vec<u8>>, valu...
  function from_cursor_str (line 229) | pub(crate) fn from_cursor_str<'a>(cursor: &mut Cursor<&'a [u8]>) -> CDRS...
  function from_cursor_str_long (line 239) | pub(crate) fn from_cursor_str_long<'a>(cursor: &mut Cursor<&'a [u8]>) ->...
  function serialize_str_list (line 249) | pub(crate) fn serialize_str_list<'a>(
  function from_cursor_string_list (line 262) | pub fn from_cursor_string_list(cursor: &mut Cursor<&[u8]>) -> CDRSResult...
  type CBytes (line 277) | pub struct CBytes {
    method new (line 283) | pub fn new(bytes: Vec<u8>) -> CBytes {
    method new_null (line 289) | pub fn new_null() -> CBytes {
    method into_bytes (line 295) | pub fn into_bytes(self) -> Option<Vec<u8>> {
    method as_slice (line 300) | pub fn as_slice(&self) -> Option<&[u8]> {
    method is_null_or_empty (line 305) | pub fn is_null_or_empty(&self) -> bool {
  method from_cursor (line 314) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> CDRSResu...
  method serialize (line 326) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  type CBytesShort (line 340) | pub struct CBytesShort {
    method new (line 346) | pub fn new(bytes: Vec<u8>) -> CBytesShort {
    method into_bytes (line 352) | pub fn into_bytes(self) -> Option<Vec<u8>> {
    method serialized_len (line 357) | pub fn serialized_len(&self) -> usize {
  method from_cursor (line 370) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> CDRSResu...
  method serialize (line 382) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  type CInt (line 395) | pub type CInt = i32;
  method from_cursor (line 398) | fn from_cursor(cursor: &mut Cursor<&[u8]>, _version: Version) -> CDRSRes...
  type CIntShort (line 407) | pub type CIntShort = i16;
  method from_cursor (line 410) | fn from_cursor(cursor: &mut Cursor<&[u8]>, _version: Version) -> CDRSRes...
  type CLong (line 419) | pub type CLong = i64;
  method from_cursor (line 422) | fn from_cursor(cursor: &mut Cursor<&[u8]>, _version: Version) -> CDRSRes...
  method serialize (line 431) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 448) | fn from_cursor(cursor: &mut Cursor<&[u8]>, version: Version) -> CDRSResu...
  function cursor_next_value (line 460) | pub fn cursor_next_value(cursor: &mut Cursor<&[u8]>, len: usize) -> CDRS...
  function cursor_next_value_ref (line 466) | pub fn cursor_next_value_ref<'a>(
  function from_i_bytes (line 490) | fn from_i_bytes(bytes: &[u8]) -> i64 {
  function try_u16_from_bytes (line 494) | fn try_u16_from_bytes(bytes: &[u8]) -> Result<u16, io::Error> {
  function to_varint (line 498) | fn to_varint(int: BigInt) -> Vec<u8> {
  function test_from_cursor_str (line 503) | fn test_from_cursor_str() {
  function test_from_cursor_str_long (line 511) | fn test_from_cursor_str_long() {
  function test_serialize_str (line 519) | fn test_serialize_str() {
  function test_serialize_str_long (line 529) | fn test_serialize_str_long() {
  function test_cstringlist (line 539) | fn test_cstringlist() {
  function test_cbytes_new (line 549) | fn test_cbytes_new() {
  function test_cbytes_into_bytes (line 555) | fn test_cbytes_into_bytes() {
  function test_cbytes_from_cursor (line 561) | fn test_cbytes_from_cursor() {
  function test_cbytes_serialize (line 569) | fn test_cbytes_serialize() {
  function test_cbytesshort_new (line 580) | fn test_cbytesshort_new() {
  function test_cbytesshort_into_bytes (line 586) | fn test_cbytesshort_into_bytes() {
  function test_cbytesshort_from_cursor (line 592) | fn test_cbytesshort_from_cursor() {
  function test_cbytesshort_serialize (line 600) | fn test_cbytesshort_serialize() {
  function test_cint_from_cursor (line 607) | fn test_cint_from_cursor() {
  function test_cintshort_from_cursor (line 615) | fn test_cintshort_from_cursor() {
  function test_cursor_next_value (line 623) | fn test_cursor_next_value() {
  function test_try_u16_from_bytes (line 632) | fn test_try_u16_from_bytes() {
  function test_from_i_bytes (line 639) | fn test_from_i_bytes() {
  function test_to_varint (line 646) | fn test_to_varint() {

FILE: cassandra-protocol/src/types/blob.rs
  type Blob (line 6) | pub struct Blob(Vec<u8>);
    method as_mut_slice (line 11) | pub fn as_mut_slice(&mut self) -> &[u8] {
    method into_vec (line 17) | pub fn into_vec(self) -> Vec<u8> {
    method from (line 24) | fn from(vec: Vec<u8>) -> Self {
    method from (line 31) | fn from(value: &[u8]) -> Self {

FILE: cassandra-protocol/src/types/cassandra_type.rs
  type CassandraType (line 13) | pub enum CassandraType {
  function wrapper_fn (line 44) | pub fn wrapper_fn(
  function custom (line 89) | pub fn custom(
  function map (line 116) | pub fn map(
  function set (line 132) | pub fn set(
  function udt (line 148) | pub fn udt(
  function tuple (line 167) | pub fn tuple(
  function null (line 186) | pub fn null(
  function blob (line 194) | pub fn blob(
  function ascii (line 207) | pub fn ascii(
  function int (line 220) | pub fn int(
  function list (line 233) | pub fn list(
  function bigint (line 245) | pub fn bigint(
  function counter (line 258) | pub fn counter(
  function decimal (line 271) | pub fn decimal(
  function double (line 284) | pub fn double(
  function float (line 297) | pub fn float(
  function timestamp (line 310) | pub fn timestamp(
  function uuid (line 323) | pub fn uuid(
  function varchar (line 336) | pub fn varchar(
  function varint (line 349) | pub fn varint(
  function timeuuid (line 362) | pub fn timeuuid(
  function inet (line 375) | pub fn inet(
  function date (line 388) | pub fn date(
  function time (line 401) | pub fn time(
  function smallint (line 414) | pub fn smallint(
  function tinyint (line 427) | pub fn tinyint(
  function bool (line 440) | pub fn bool(
  function duration (line 453) | pub fn duration(

FILE: cassandra-protocol/src/types/data_serialization_types.rs
  constant FALSE_BYTE (line 20) | const FALSE_BYTE: u8 = 0;
  function decode_custom (line 24) | pub fn decode_custom(bytes: &[u8]) -> Result<String, FromUtf8Error> {
  function decode_ascii (line 33) | pub fn decode_ascii(bytes: &[u8]) -> Result<String, FromUtf8Error> {
  function decode_varchar (line 42) | pub fn decode_varchar(bytes: &[u8]) -> Result<String, FromUtf8Error> {
  function decode_bigint (line 52) | pub fn decode_bigint(bytes: &[u8]) -> Result<i64, io::Error> {
  function decode_blob (line 58) | pub fn decode_blob(bytes: &[u8]) -> Result<Blob, io::Error> {
  function decode_boolean (line 65) | pub fn decode_boolean(bytes: &[u8]) -> Result<bool, io::Error> {
  function decode_int (line 78) | pub fn decode_int(bytes: &[u8]) -> Result<i32, io::Error> {
  function decode_date (line 87) | pub fn decode_date(bytes: &[u8]) -> Result<i32, io::Error> {
  function decode_decimal (line 92) | pub fn decode_decimal(bytes: &[u8]) -> Result<Decimal, io::Error> {
  function decode_double (line 112) | pub fn decode_double(bytes: &[u8]) -> Result<f64, io::Error> {
  function decode_float (line 118) | pub fn decode_float(bytes: &[u8]) -> Result<f32, io::Error> {
  function decode_inet (line 124) | pub fn decode_inet(bytes: &[u8]) -> Result<net::IpAddr, io::Error> {
  function decode_timestamp (line 145) | pub fn decode_timestamp(bytes: &[u8]) -> Result<i64, io::Error> {
  function decode_list (line 150) | pub fn decode_list(bytes: &[u8], version: Version) -> Result<Vec<CBytes>...
  function decode_float_vector (line 168) | pub fn decode_float_vector(
  function decode_set (line 206) | pub fn decode_set(bytes: &[u8], version: Version) -> Result<Vec<CBytes>,...
  function decode_map (line 211) | pub fn decode_map(bytes: &[u8], version: Version) -> Result<Vec<(CBytes,...
  function decode_smallint (line 231) | pub fn decode_smallint(bytes: &[u8]) -> Result<i16, io::Error> {
  function decode_tinyint (line 236) | pub fn decode_tinyint(bytes: &[u8]) -> Result<i8, io::Error> {
  function decode_text (line 248) | pub fn decode_text(bytes: &[u8]) -> Result<String, FromUtf8Error> {
  function decode_time (line 256) | pub fn decode_time(bytes: &[u8]) -> Result<i64, io::Error> {
  function decode_timeuuid (line 262) | pub fn decode_timeuuid(bytes: &[u8]) -> Result<uuid::Uuid, uuid::Error> {
  function decode_varint (line 268) | pub fn decode_varint(bytes: &[u8]) -> Result<BigInt, io::Error> {
  function decode_duration (line 274) | pub fn decode_duration(bytes: &[u8]) -> Result<Duration, io::Error> {
  function decode_udt (line 298) | pub fn decode_udt(bytes: &[u8], l: usize, version: Version) -> Result<Ve...
  function decode_tuple (line 323) | pub fn decode_tuple(bytes: &[u8], l: usize, version: Version) -> Result<...
  function decode_custom_test (line 344) | fn decode_custom_test() {
  function decode_ascii_test (line 349) | fn decode_ascii_test() {
  function decode_varchar_test (line 354) | fn decode_varchar_test() {
  function decode_bigint_test (line 359) | fn decode_bigint_test() {
  function decode_blob_test (line 364) | fn decode_blob_test() {
  function decode_boolean_test (line 372) | fn decode_boolean_test() {
  function decode_int_test (line 379) | fn decode_int_test() {
  function decode_date_test (line 384) | fn decode_date_test() {
  function decode_double_test (line 389) | fn decode_double_test() {
  function decode_float_test (line 399) | fn decode_float_test() {
  function decode_inet_test (line 409) | fn decode_inet_test() {
  function decode_timestamp_test (line 424) | fn decode_timestamp_test() {
  function decode_list_test (line 429) | fn decode_list_test() {
  function decode_duration_test (line 436) | fn decode_duration_test() {
  function decode_set_test (line 442) | fn decode_set_test() {
  function decode_map_test (line 449) | fn decode_map_test() {
  function decode_smallint_test (line 461) | fn decode_smallint_test() {
  function decode_tinyint_test (line 466) | fn decode_tinyint_test() {
  function decode_tinyint_empty_returns_error_not_panic (line 471) | fn decode_tinyint_empty_returns_error_not_panic() {
  function decode_decimal_short_input_returns_error_not_panic (line 478) | fn decode_decimal_short_input_returns_error_not_panic() {
  function decode_float_vector_short_input_returns_error_not_panic (line 486) | fn decode_float_vector_short_input_returns_error_not_panic() {
  function decode_decimal_test (line 494) | fn decode_decimal_test() {
  function decode_text_test (line 522) | fn decode_text_test() {
  function decode_string_returns_error_on_invalid_utf8 (line 532) | fn decode_string_returns_error_on_invalid_utf8() {
  function decode_time_test (line 555) | fn decode_time_test() {
  function decode_timeuuid_test (line 560) | fn decode_timeuuid_test() {
  function decode_varint_test (line 570) | fn decode_varint_test() {
  function decode_udt_test (line 582) | fn decode_udt_test() {
  function as_rust_blob_test (line 589) | fn as_rust_blob_test() {
  function as_rust_v4_blob_test (line 610) | fn as_rust_v4_blob_test() {
  function as_rust_string_test (line 628) | fn as_rust_string_test() {
  function as_rust_bool_test (line 662) | fn as_rust_bool_test() {
  function as_rust_v4_bool_test (line 683) | fn as_rust_v4_bool_test() {
  function as_rust_i64_test (line 701) | fn as_rust_i64_test() {
  function as_rust_v4_i64_test (line 729) | fn as_rust_v4_i64_test() {
  function as_rust_i32_test (line 758) | fn as_rust_i32_test() {
  function as_rust_v4_i32_test (line 778) | fn as_rust_v4_i32_test() {
  function as_rust_i16_test (line 797) | fn as_rust_i16_test() {
  function as_rust_v4_i16_test (line 815) | fn as_rust_v4_i16_test() {
  function as_rust_i8_test (line 830) | fn as_rust_i8_test() {
  function as_rust_v4_i8_test (line 845) | fn as_rust_v4_i8_test() {
  function as_rust_f64_test (line 857) | fn as_rust_f64_test() {
  function as_rust_v4_f64_test (line 876) | fn as_rust_v4_f64_test() {
  function as_rust_f32_test (line 892) | fn as_rust_f32_test() {
  function as_rust_v4_f32_test (line 913) | fn as_rust_v4_f32_test() {
  function as_rust_inet_test (line 931) | fn as_rust_inet_test() {
  function as_rust_v4_inet_test (line 950) | fn as_rust_v4_inet_test() {

FILE: cassandra-protocol/src/types/decimal.rs
  type Decimal (line 10) | pub struct Decimal {
    method as_plain (line 21) | pub fn as_plain(&self) -> BigInt {
    method from (line 69) | fn from(f: f32) -> Decimal {
    method from (line 97) | fn from(f: f64) -> Decimal {
  method serialize (line 40) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from (line 120) | fn from(value: Decimal) -> Self {
  function serialize_test (line 130) | fn serialize_test() {
  function from_f32 (line 155) | fn from_f32() {
  function from_f64 (line 171) | fn from_f64() {
  function from_f32_tolerates_inexact_floats (line 192) | fn from_f32_tolerates_inexact_floats() {
  function from_f64_tolerates_inexact_floats (line 199) | fn from_f64_tolerates_inexact_floats() {
  function as_plain_does_not_panic_on_negative_scale (line 209) | fn as_plain_does_not_panic_on_negative_scale() {

FILE: cassandra-protocol/src/types/duration.rs
  type DurationCreationError (line 9) | pub enum DurationCreationError {
  type Duration (line 24) | pub struct Duration {
    method new (line 31) | pub fn new(months: i32, days: i32, nanoseconds: i64) -> Result<Self, D...
    method months (line 49) | pub fn months(&self) -> i32 {
    method days (line 53) | pub fn days(&self) -> i32 {
    method nanoseconds (line 57) | pub fn nanoseconds(&self) -> i64 {
  method serialize (line 63) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, _version: Version) {
  function should_serialize_duration (line 84) | fn should_serialize_duration() {

FILE: cassandra-protocol/src/types/from_cdrs.rs
  type FromCdrs (line 17) | pub trait FromCdrs {
    method from_cdrs (line 18) | fn from_cdrs<T>(cdrs_type: T) -> CdrsResult<Option<Self>>
    method from_cdrs_r (line 26) | fn from_cdrs_r<T>(cdrs_type: T) -> CdrsResult<Self>
  type FromCdrsByName (line 59) | pub trait FromCdrsByName {
    method from_cdrs_by_name (line 60) | fn from_cdrs_by_name<T>(cdrs_type: &T, name: &str) -> CdrsResult<Optio...
    method from_cdrs_r (line 68) | fn from_cdrs_r<T>(cdrs_type: &T, name: &str) -> CdrsResult<Self>

FILE: cassandra-protocol/src/types/list.rs
  type List (line 20) | pub struct List {
    method map (line 29) | fn map<T, F>(&self, f: F) -> Vec<T>
    method try_map (line 36) | fn try_map<T, F>(&self, f: F) -> Result<Vec<T>>

FILE: cassandra-protocol/src/types/map.rs
  type Map (line 19) | pub struct Map {
    method new (line 27) | pub fn new(data: Vec<(CBytes, CBytes)>, meta: ColTypeOption, protocol_...

FILE: cassandra-protocol/src/types/rows.rs
  type Row (line 25) | pub struct Row {
    method from_body (line 32) | pub fn from_body(body: BodyResResultRows) -> Vec<Row> {
    method contains_column (line 46) | pub fn contains_column(&self, name: &str) -> bool {
    method is_empty (line 54) | pub fn is_empty(&self, index: usize) -> bool {
    method is_empty_by_name (line 62) | pub fn is_empty_by_name(&self, name: &str) -> bool {
    method col_spec_by_name (line 71) | fn col_spec_by_name(&self, name: &str) -> Option<(&ColSpec, &CBytes)> {
    method col_spec_by_index (line 83) | fn col_spec_by_index(&self, index: usize) -> Option<(&ColSpec, &CBytes...

FILE: cassandra-protocol/src/types/tuple.rs
  type Tuple (line 20) | pub struct Tuple {
    method new (line 50) | pub fn new(elements: Vec<CBytes>, metadata: &CTuple, protocol_version:...
  method eq (line 26) | fn eq(&self, other: &Tuple) -> bool {
  method hash (line 42) | fn hash<H: Hasher>(&self, state: &mut H) {

FILE: cassandra-protocol/src/types/udt.rs
  type Udt (line 22) | pub struct Udt {
    method new (line 28) | pub fn new(fields: Vec<CBytes>, metadata: &CUdt, protocol_version: Ver...

FILE: cassandra-protocol/src/types/value.rs
  constant NULL_INT_VALUE (line 20) | const NULL_INT_VALUE: i32 = -1;
  constant NOT_SET_INT_VALUE (line 21) | const NOT_SET_INT_VALUE: i32 = -2;
  type Value (line 25) | pub enum Value {
    method new (line 32) | pub fn new<B>(v: B) -> Value
    method from (line 84) | fn from(b: T) -> Value {
    method from (line 90) | fn from(b: Option<T>) -> Value {
  method serialize (line 41) | fn serialize(&self, cursor: &mut Cursor<&mut Vec<u8>>, version: Version) {
  method from_cursor (line 55) | fn from_cursor(cursor: &mut Cursor<&[u8]>, _version: Version) -> Result<...
  type Bytes (line 99) | pub struct Bytes(Vec<u8>);
    method into_inner (line 103) | pub fn into_inner(self) -> Vec<u8> {
    method from (line 110) | fn from(value: String) -> Self {
    method from (line 117) | fn from(value: &str) -> Self {
    method from (line 124) | fn from(value: i8) -> Self {
    method from (line 131) | fn from(value: i16) -> Self {
    method from (line 138) | fn from(value: i32) -> Self {
    method from (line 145) | fn from(value: i64) -> Self {
    method from (line 152) | fn from(value: u8) -> Self {
    method from (line 159) | fn from(value: u16) -> Self {
    method from (line 166) | fn from(value: u32) -> Self {
    method from (line 173) | fn from(value: u64) -> Self {
    method from (line 180) | fn from(value: NonZeroI8) -> Self {
    method from (line 187) | fn from(value: NonZeroI16) -> Self {
    method from (line 194) | fn from(value: NonZeroI32) -> Self {
    method from (line 201) | fn from(value: NonZeroI64) -> Self {
    method from (line 208) | fn from(value: bool) -> Self {
    method from (line 219) | fn from(value: Uuid) -> Self {
    method from (line 226) | fn from(value: IpAddr) -> Self {
    method from (line 236) | fn from(value: f32) -> Self {
    method from (line 243) | fn from(value: f64) -> Self {
    method from (line 250) | fn from(value: PrimitiveDateTime) -> Self {
    method from (line 259) | fn from(value: Blob) -> Self {
    method from (line 266) | fn from(value: Decimal) -> Self {
    method from (line 273) | fn from(value: NaiveDateTime) -> Self {
    method from (line 280) | fn from(value: DateTime<Utc>) -> Self {
    method from (line 287) | fn from(value: Duration) -> Self {
    method from (line 293) | fn from(vec: Vec<T>) -> Bytes {
    method from (line 312) | fn from(value: BigInt) -> Self {
    method from (line 322) | fn from(map: HashMap<K, V>) -> Bytes {
    method from (line 348) | fn from(map: BTreeMap<K, V>) -> Bytes {
  function test_value_serialization (line 374) | fn test_value_serialization() {
  function test_value_from_cursor_handles_all_lengths (line 396) | fn test_value_from_cursor_handles_all_lengths() {
  function test_new_value_all_types (line 438) | fn test_new_value_all_types() {

FILE: cassandra-protocol/src/types/vector.rs
  type Vector (line 11) | pub struct Vector {
    method try_map (line 20) | fn try_map<T, F>(&self, f: F) -> Result<Vec<T>>
  type VectorInfo (line 28) | pub struct VectorInfo {
  function get_vector_type_info (line 33) | pub fn get_vector_type_info(option_value: &ColTypeOptionValue) -> Result...

FILE: cdrs-tokio-helpers-derive/src/common.rs
  function get_struct_fields (line 10) | pub fn get_struct_fields(ast: &DeriveInput) -> Result<Vec<TokenStream>> {
  function struct_fields (line 27) | pub fn struct_fields(ast: &DeriveInput) -> Result<&FieldsNamed> {
  function extract_type (line 39) | fn extract_type(arg: &GenericArgument) -> Result<Type> {
  function get_map_params_string (line 46) | pub fn get_map_params_string(ty: &Type, name: &str) -> Result<(Type, Typ...
  function remove_r (line 76) | fn remove_r(s: String) -> String {
  function convert_field_into_rust (line 84) | fn convert_field_into_rust(field: Field) -> Result<TokenStream> {
  function get_arguments (line 99) | fn get_arguments(name: TokenStream) -> TokenStream {
  function into_rust_with_args (line 105) | fn into_rust_with_args(
  function is_non_zero_primitive (line 170) | fn is_non_zero_primitive(ty: &Type, name: &str) -> Result<bool> {
  function get_cdrs_type (line 179) | fn get_cdrs_type(ty: &Type, name: &str) -> Result<Type> {
  function get_ident (line 209) | fn get_ident<'a>(ty: &'a Type, name: &str) -> Result<&'a Ident> {
  function as_rust (line 230) | fn as_rust(ty: &Type, val: TokenStream, name: &str) -> Result<TokenStrea...
  function get_ident_string (line 277) | pub fn get_ident_string(ty: &Type, name: &str) -> Result<String> {
  function get_ident_params_string (line 281) | pub fn get_ident_params_string(ty: &Type, name: &str) -> Result<Type> {

FILE: cdrs-tokio-helpers-derive/src/db_mirror.rs
  function impl_db_mirror (line 9) | pub fn impl_db_mirror(ast: &DeriveInput) -> Result<TokenStream> {

FILE: cdrs-tokio-helpers-derive/src/into_cdrs_value.rs
  function impl_into_cdrs_value (line 9) | pub fn impl_into_cdrs_value(ast: &DeriveInput) -> Result<TokenStream> {

FILE: cdrs-tokio-helpers-derive/src/lib.rs
  function db_mirror (line 18) | pub fn db_mirror(input: TokenStream) -> TokenStream {
  function into_cdrs_value (line 29) | pub fn into_cdrs_value(input: TokenStream) -> TokenStream {
  function try_from_row (line 40) | pub fn try_from_row(input: TokenStream) -> TokenStream {
  function try_from_udt (line 51) | pub fn try_from_udt(input: TokenStream) -> TokenStream {

FILE: cdrs-tokio-helpers-derive/src/try_from_row.rs
  function impl_try_from_row (line 7) | pub fn impl_try_from_row(ast: &DeriveInput) -> Result<TokenStream> {

FILE: cdrs-tokio-helpers-derive/src/try_from_udt.rs
  function impl_try_from_udt (line 7) | pub fn impl_try_from_udt(ast: &DeriveInput) -> Result<TokenStream> {

FILE: cdrs-tokio/examples/crud_operations.rs
  type CurrentSession (line 15) | type CurrentSession = Session<
  function main (line 22) | async fn main() {
  type RowStruct (line 48) | struct RowStruct {
    method into_query_values (line 56) | fn into_query_values(self) -> QueryValues {
  type User (line 62) | struct User {
  function create_keyspace (line 66) | async fn create_keyspace(session: &mut CurrentSession) {
  function create_udt (line 75) | async fn create_udt(session: &mut CurrentSession) {
  function create_table (line 83) | async fn create_table(session: &mut CurrentSession) {
  function insert_struct (line 93) | async fn insert_struct(session: &mut CurrentSession) {
  function select_struct (line 113) | async fn select_struct(session: &mut CurrentSession) {
  function update_struct (line 130) | async fn update_struct(session: &mut CurrentSession) {
  function delete_struct (line 142) | async fn delete_struct(session: &mut CurrentSession) {

FILE: cdrs-tokio/examples/generic_connection.rs
  type CurrentSession (line 37) | type CurrentSession = Session<
  type VirtualClusterConfig (line 54) | struct VirtualClusterConfig {
    method create_manager (line 128) | fn create_manager(
    method event_channel_capacity (line 137) | fn event_channel_capacity(&self) -> usize {
    method version (line 141) | fn version(&self) -> Version {
    method connection_pool_config (line 145) | fn connection_pool_config(&self) -> ConnectionPoolConfig {
  function rewrite (line 61) | fn rewrite(addr: SocketAddr, mask: &Ipv4Addr, actual: &Ipv4Addr) -> Sock...
  type VirtualConnectionManager (line 83) | struct VirtualConnectionManager {
    method connection (line 90) | fn connection(
    method new (line 105) | async fn new(
  function main (line 151) | async fn main() {
  type RowStruct (line 194) | struct RowStruct {
    method into_query_values (line 202) | fn into_query_values(self) -> QueryValues {
  type User (line 208) | struct User {
  function create_keyspace (line 212) | async fn create_keyspace(session: &mut CurrentSession) {
  function create_udt (line 221) | async fn create_udt(session: &mut CurrentSession) {
  function create_table (line 229) | async fn create_table(session: &mut CurrentSession) {
  function insert_struct (line 240) | async fn insert_struct(session: &mut CurrentSession) {
  function select_struct (line 261) | async fn select_struct(session: &mut CurrentSession) {
  function update_struct (line 279) | async fn update_struct(session: &mut CurrentSession) {
  function delete_struct (line 291) | async fn delete_struct(session: &mut CurrentSession) {

FILE: cdrs-tokio/examples/insert_collection.rs
  type CurrentSession (line 15) | type CurrentSession = Session<
  function main (line 22) | async fn main() {
  type RowStruct (line 53) | struct RowStruct {
    method into_query_values (line 61) | fn into_query_values(self) -> QueryValues {
  type User (line 67) | struct User {
  function create_keyspace (line 71) | async fn create_keyspace(session: &mut CurrentSession) {
  function create_udt (line 80) | async fn create_udt(session: &mut CurrentSession) {
  function create_table (line 88) | async fn create_table(session: &mut CurrentSession) {
  function append_list (line 99) | async fn append_list(session: &mut CurrentSession) {
  function prepend_list (line 117) | async fn prepend_list(session: &mut CurrentSession) {
  function append_set (line 135) | async fn append_set(session: &mut CurrentSession) {
  function append_map (line 153) | async fn append_map(session: &mut CurrentSession) {
  function insert_struct (line 167) | async fn insert_struct(session: &mut CurrentSession) {
  function select_struct (line 187) | async fn select_struct(session: &mut CurrentSession) {
  function delete_struct (line 204) | async fn delete_struct(session: &mut CurrentSession) {

FILE: cdrs-tokio/examples/multiple_thread.rs
  type CurrentSession (line 12) | type CurrentSession = Session<
  function main (line 19) | async fn main() {
  type RowStruct (line 50) | struct RowStruct {
    method into_query_values (line 55) | fn into_query_values(self) -> QueryValues {
  type User (line 61) | struct User {
  function create_keyspace (line 65) | async fn create_keyspace(session: Arc<CurrentSession>) {
  function create_table (line 74) | async fn create_table(session: Arc<CurrentSession>) {
  function insert_struct (line 83) | async fn insert_struct(session: Arc<CurrentSession>, key: i32) {
  function select_struct (line 93) | async fn select_struct(session: Arc<CurrentSession>) {

FILE: cdrs-tokio/examples/paged_query.rs
  type CurrentSession (line 12) | type CurrentSession = Session<
  type RowStruct (line 19) | struct RowStruct {
    method into_query_values (line 24) | fn into_query_values(self) -> QueryValues {
  type AnotherTestTable (line 30) | struct AnotherTestTable {
    method into_query_values (line 39) | fn into_query_values(self) -> QueryValues {
  function main (line 45) | async fn main() {
  function create_keyspace (line 73) | async fn create_keyspace(session: &CurrentSession) {
  function create_udt (line 82) | async fn create_udt(session: &CurrentSession) {
  function create_table (line 90) | async fn create_table(session: &CurrentSession) {
  function fill_table (line 100) | async fn fill_table(session: &CurrentSession) {
  function paged_selection_query (line 113) | async fn paged_selection_query(session: &CurrentSession) {
  function paged_with_value (line 131) | async fn paged_with_value(session: &CurrentSession) {
  function paged_with_values_list (line 180) | async fn paged_with_values_list(session: &CurrentSession) {
  function paged_selection_query_with_state (line 223) | async fn paged_selection_query_with_state(session: &CurrentSession, stat...

FILE: cdrs-tokio/examples/prepare_batch_execute.rs
  type CurrentSession (line 11) | type CurrentSession = Session<
  type RowStruct (line 18) | struct RowStruct {
    method into_query_values (line 23) | fn into_query_values(self) -> QueryValues {
  function main (line 31) | async fn main() {
  function create_keyspace (line 62) | async fn create_keyspace(session: &mut CurrentSession) {
  function create_table (line 71) | async fn create_table(session: &mut CurrentSession) {
  function insert_row (line 80) | async fn insert_row(session: &mut CurrentSession, row: RowStruct, prepar...
  function batch_few_queries (line 87) | async fn batch_few_queries(session: &mut CurrentSession, query: &str) {

FILE: cdrs-tokio/src/cluster.rs
  type GenericClusterConfig (line 55) | pub trait GenericClusterConfig<T: CdrsTransport, CM: ConnectionManager<T...
    method create_manager (line 56) | fn create_manager(
    method event_channel_capacity (line 63) | fn event_channel_capacity(&self) -> usize;
    method version (line 66) | fn version(&self) -> Version;
    method connection_pool_config (line 69) | fn connection_pool_config(&self) -> ConnectionPoolConfig;
    method beta_protocol (line 72) | fn beta_protocol(&self) -> bool {

FILE: cdrs-tokio/src/cluster/cluster_metadata_manager.rs
  function find_in_peers (line 37) | fn find_in_peers(
  function send_query (line 54) | async fn send_query<T: CdrsTransport>(
  function send_query_with_values (line 64) | async fn send_query_with_values<T: CdrsTransport, V: Into<QueryValues>>(
  function send_query_with_params (line 75) | async fn send_query_with_params<T: CdrsTransport>(
  function build_node_info (line 102) | fn build_node_info(row: &Row, broadcast_rpc_address: SocketAddr) -> Resu...
  function build_node_broadcast_rpc_address (line 147) | fn build_node_broadcast_rpc_address(
  function broadcast_rpc_address_from_row (line 163) | fn broadcast_rpc_address_from_row(row: &Row, control_addr: SocketAddr) -...
  function is_peer_row_valid (line 210) | fn is_peer_row_valid(row: &Row) -> bool {
  function fetch_control_connection_info (line 224) | async fn fetch_control_connection_info<T: CdrsTransport>(
  function build_keyspace (line 241) | fn build_keyspace(row: &Row) -> Result<(String, KeyspaceMetadata)> {
  function build_replication_strategy (line 263) | fn build_replication_strategy(
  function extract_datacenter_replication_factor (line 288) | fn extract_datacenter_replication_factor(
  function extract_replication_factor (line 300) | fn extract_replication_factor(value: Option<&JsonValue>) -> Result<usize> {
  type ClusterMetadataManager (line 317) | pub(crate) struct ClusterMetadataManager<
  function new (line 333) | pub(crate) fn new(
  function listen_to_events (line 354) | pub(crate) fn listen_to_events(self: &Arc<Self>, mut event_receiver: Rec...
  function process_event (line 376) | async fn process_event(&self, event: ServerEvent) {
  function process_schema_event (line 387) | async fn process_schema_event(&self, event: SchemaChange) {
  function process_topology_event (line 401) | async fn process_topology_event(&self, event: TopologyChange) {
  function process_status_event (line 431) | async fn process_status_event(&self, event: StatusChange) {
  function remove_keyspace (line 503) | fn remove_keyspace(&self, keyspace: &str) {
  function refresh_keyspace (line 512) | async fn refresh_keyspace(&self, keyspace: &str) {
  function try_refresh_keyspace (line 518) | async fn try_refresh_keyspace(&self, keyspace: &str) -> Result<()> {
  function add_new_node (line 559) | async fn add_new_node(
  function find_new_node_info (line 586) | async fn find_new_node_info(
  function control_transport (line 624) | fn control_transport(&self) -> Result<Arc<T>> {
  function peer_table_name (line 633) | fn peer_table_name(&self) -> &'static str {
  function metadata (line 642) | pub(crate) fn metadata(&self) -> Arc<ClusterMetadata<T, CM>> {
  function find_node_by_rpc_address (line 647) | pub(crate) fn find_node_by_rpc_address(
  function refresh_metadata (line 657) | pub(crate) async fn refresh_metadata(&self, full_refresh: bool) -> Resul...
  function refresh_keyspaces (line 697) | async fn refresh_keyspaces(&self) -> Result<FxHashMap<String, KeyspaceMe...
  function refresh_node_infos (line 713) | async fn refresh_node_infos(&self) -> Result<Vec<NodeInfo>> {
  function query_peers (line 757) | async fn query_peers(&self, transport: &T) -> Result<Option<Vec<Row>>> {
  function query_legacy_peers (line 801) | async fn query_legacy_peers(&self, transport: &T) -> Result<Option<Vec<R...

FILE: cdrs-tokio/src/cluster/config_proxy.rs
  type HttpBasicAuth (line 2) | pub(crate) struct HttpBasicAuth {
  type HttpProxyConfig (line 8) | pub struct HttpProxyConfig {
  type HttpProxyConfigBuilder (line 14) | pub struct HttpProxyConfigBuilder {
    method new (line 21) | pub fn new(address: String) -> Self {
    method with_basic_auth (line 29) | pub fn with_basic_auth(mut self, username: String, password: String) -...
    method build (line 35) | pub fn build(self) -> HttpProxyConfig {

FILE: cdrs-tokio/src/cluster/config_rustls.rs
  type NodeRustlsConfig (line 16) | pub struct NodeRustlsConfig {
  type NodeRustlsConfigBuilder (line 31) | pub struct NodeRustlsConfigBuilder {
    method new (line 44) | pub fn new(dns_name: ServerName<'static>, config: Arc<ClientConfig>) -...
    method with_authenticator_provider (line 59) | pub fn with_authenticator_provider(
    method with_contact_point (line 70) | pub fn with_contact_point(mut self, addr: NodeAddress) -> Self {
    method with_contact_points (line 77) | pub fn with_contact_points(mut self, addr: Vec<NodeAddress>) -> Self {
    method with_version (line 84) | pub fn with_version(mut self, version: Version) -> Self {
    method with_beta_protocol (line 91) | pub fn with_beta_protocol(mut self, beta_protocol: bool) -> Self {
    method with_http_proxy (line 99) | pub fn with_http_proxy(mut self, config: HttpProxyConfig) -> Self {
    method build (line 105) | pub async fn build(self) -> Result<NodeRustlsConfig> {

FILE: cdrs-tokio/src/cluster/config_tcp.rs
  type NodeTcpConfig (line 15) | pub struct NodeTcpConfig {
  type NodeTcpConfigBuilder (line 28) | pub struct NodeTcpConfigBuilder {
    method new (line 52) | pub fn new() -> NodeTcpConfigBuilder {
    method with_authenticator_provider (line 58) | pub fn with_authenticator_provider(
    method with_contact_point (line 69) | pub fn with_contact_point(mut self, addr: NodeAddress) -> Self {
    method with_contact_points (line 76) | pub fn with_contact_points(mut self, addr: Vec<NodeAddress>) -> Self {
    method with_version (line 83) | pub fn with_version(mut self, version: Version) -> Self {
    method with_beta_protocol (line 90) | pub fn with_beta_protocol(mut self, beta_protocol: bool) -> Self {
    method with_http_proxy (line 98) | pub fn with_http_proxy(mut self, config: HttpProxyConfig) -> Self {
    method build (line 104) | pub async fn build(self) -> Result<NodeTcpConfig> {
  method default (line 39) | fn default() -> Self {

FILE: cdrs-tokio/src/cluster/connection_manager.rs
  type ConnectionManager (line 19) | pub trait ConnectionManager<T: CdrsTransport>: Send + Sync {
    method connection (line 22) | fn connection(
  function startup (line 47) | pub async fn startup<
  function set_keyspace (line 130) | async fn set_keyspace<T: CdrsTransport>(

FILE: cdrs-tokio/src/cluster/connection_pool.rs
  type ReconnectionState (line 27) | enum ReconnectionState {
  function new_connection (line 33) | async fn new_connection<T: CdrsTransport, CM: ConnectionManager<T>>(
  type ConnectionPoolConfig (line 62) | pub struct ConnectionPoolConfig {
  method default (line 70) | fn default() -> Self {
  type ConnectionPoolConfigBuilder (line 82) | pub struct ConnectionPoolConfigBuilder {
    method new (line 87) | pub fn new() -> Self {
    method with_local_size (line 93) | pub fn with_local_size(mut self, local_size: usize) -> Self {
    method with_remote_size (line 100) | pub fn with_remote_size(mut self, remote_size: usize) -> Self {
    method with_connect_timeout (line 107) | pub fn with_connect_timeout(mut self, connect_timeout: Option<Duration...
    method with_heartbeat_interval (line 114) | pub fn with_heartbeat_interval(mut self, heartbeat_interval: Duration)...
    method build (line 121) | pub fn build(self) -> ConnectionPoolConfig {
  type ConnectionPoolFactory (line 126) | pub(crate) struct ConnectionPoolFactory<
  function new (line 139) | pub(crate) fn new(
  function connection_manager (line 157) | pub(crate) fn connection_manager(&self) -> &CM {
  function create (line 161) | pub(crate) async fn create(
  function start_heartbeat (line 259) | fn start_heartbeat(
  function monitor_connections (line 310) | fn monitor_connections(
  function are_all_connections_down (line 422) | async fn are_all_connections_down(pool: &ConnectionPool<T, CM>) -> bool {
  function run_reconnection_loop (line 433) | async fn run_reconnection_loop(
  type ConnectionPool (line 457) | pub(crate) struct ConnectionPool<T: CdrsTransport, CM: ConnectionManager...
  function new (line 468) | async fn new(
  function connection (line 523) | pub(crate) async fn connection(&self) -> CdrsResult<Arc<T>> {
  function is_any_connection_up (line 556) | pub(crate) async fn is_any_connection_up(&self) -> bool {
  function reconnect_broken (line 567) | async fn reconnect_broken(&self) -> CdrsResult<bool> {
  function create_heartbeat_interval (line 617) | fn create_heartbeat_interval(now: Instant, period: Duration) -> Interval {
  function create_heartbeat_interval_skips_missed_ticks (line 628) | async fn create_heartbeat_interval_skips_missed_ticks() {

FILE: cdrs-tokio/src/cluster/control_connection.rs
  constant DEFAULT_RECONNECT_DELAY (line 17) | const DEFAULT_RECONNECT_DELAY: Duration = Duration::from_secs(10);
  constant EVENT_CHANNEL_CAPACITY (line 18) | const EVENT_CHANNEL_CAPACITY: usize = 32;
  type ControlConnection (line 21) | pub(crate) struct ControlConnection<
  function run (line 41) | pub(crate) async fn run(self, init_complete_sender: tokio::sync::oneshot...
  function wait_for_reconnection (line 152) | async fn wait_for_reconnection(schedule: &mut Box<dyn ReconnectionSchedu...
  function process_events (line 158) | fn process_events(

FILE: cdrs-tokio/src/cluster/keyspace_holder.rs
  type KeyspaceHolder (line 8) | pub struct KeyspaceHolder {
    method new (line 14) | pub fn new(keyspace_sender: Sender<Option<String>>) -> Self {
    method current_keyspace (line 22) | pub fn current_keyspace(&self) -> Option<Arc<String>> {
    method update_current_keyspace (line 27) | pub fn update_current_keyspace(&self, keyspace: String) {
    method update_current_keyspace_without_notification (line 41) | pub fn update_current_keyspace_without_notification(&self, keyspace: S...
    method send_notification (line 46) | fn send_notification(&self, keyspace: String) {

FILE: cdrs-tokio/src/cluster/metadata_builder.rs
  function build_initial_metadata (line 12) | pub(crate) fn build_initial_metadata<T: CdrsTransport, CM: ConnectionMan...
  function refresh_metadata (line 56) | pub(crate) fn refresh_metadata<T: CdrsTransport, CM: ConnectionManager<T>>(
  function add_new_node (line 105) | pub(crate) fn add_new_node<T: CdrsTransport, CM: ConnectionManager<T>>(
  function create_connection_pool_factory (line 158) | fn create_connection_pool_factory(
  function should_create_initial_metadata_from_all_new_nodes (line 176) | fn should_create_initial_metadata_from_all_new_nodes() {
  function should_copy_old_node (line 213) | fn should_copy_old_node() {
  function should_replace_old_metadata_nodes_with_new (line 258) | fn should_replace_old_metadata_nodes_with_new() {
  function should_update_old_metadata_nodes_with_new_info (line 313) | fn should_update_old_metadata_nodes_with_new_info() {
  function should_not_add_already_existing_node (line 363) | fn should_not_add_already_existing_node() {
  function should_update_existing_node (line 417) | fn should_update_existing_node() {
  function should_add_new_node (line 468) | fn should_add_new_node() {

FILE: cdrs-tokio/src/cluster/node_address.rs
  type NodeAddress (line 11) | pub enum NodeAddress {
    method from (line 17) | fn from(addr: SocketAddr) -> Self {
    method from (line 23) | fn from(value: String) -> Self {
    method from (line 29) | fn from(value: &String) -> Self {
    method from (line 35) | fn from(value: &str) -> Self {
    method resolve_address (line 42) | pub async fn resolve_address(&self) -> Result<Vec<SocketAddr>> {

FILE: cdrs-tokio/src/cluster/node_info.rs
  type NodeInfo (line 11) | pub struct NodeInfo {

FILE: cdrs-tokio/src/cluster/pager.rs
  type SessionPager (line 14) | pub struct SessionPager<
  function new (line 31) | pub fn new(session: &'a Session<T, CM, LB>, page_size: i32) -> SessionPa...
  function query_with_pager_state (line 35) | pub fn query_with_pager_state<Q>(
  function query_with_pager_state_params (line 46) | pub fn query_with_pager_state_params<Q>(
  function query (line 64) | pub fn query<Q>(&'a mut self, query: Q) -> QueryPager<'a, Q, SessionPage...
  function query_with_params (line 76) | pub fn query_with_params<Q>(
  function exec_with_pager_state (line 87) | pub fn exec_with_pager_state(
  function exec (line 99) | pub fn exec(
  type QueryPager (line 107) | pub struct QueryPager<'a, Q: ToString, P: 'a> {
  function into_pager_state (line 123) | pub fn into_pager_state(self) -> PagerState {
  function next (line 127) | pub async fn next(&mut self) -> error::Result<Vec<Row>> {
  function has_more (line 159) | pub fn has_more(&self) -> bool {
  function pager_state (line 165) | pub fn pager_state(&self) -> PagerState {
  type ExecPager (line 170) | pub struct ExecPager<'a, P: 'a> {
  function into_pager_state (line 183) | pub fn into_pager_state(self) -> PagerState {
  function next (line 187) | pub async fn next(&mut self) -> error::Result<Vec<Row>> {
  function has_more (line 213) | pub fn has_more(&self) -> bool {
  function pager_state (line 220) | pub fn pager_state(&self) -> PagerState {
  type PagerState (line 226) | pub struct PagerState {
    method new (line 232) | pub fn new() -> Self {
    method new_with_cursor (line 236) | pub fn new_with_cursor(cursor: CBytes) -> Self {
    method new_with_cursor_and_more_flag (line 243) | pub fn new_with_cursor_and_more_flag(cursor: CBytes, has_more: bool) -...
    method has_more (line 251) | pub fn has_more(&self) -> bool {
    method cursor (line 256) | pub fn cursor(&self) -> Option<CBytes> {
    method into_cursor (line 261) | pub fn into_cursor(self) -> Option<CBytes> {

FILE: cdrs-tokio/src/cluster/rustls_connection_manager.rs
  type RustlsConnectionManager (line 26) | pub struct RustlsConnectionManager {
    method connection (line 42) | fn connection(
    method new (line 55) | pub fn new(
    method create_transport (line 84) | async fn create_transport(
    method create_transport (line 148) | async fn create_transport(
    method establish_connection (line 172) | async fn establish_connection(

FILE: cdrs-tokio/src/cluster/send_envelope.rs
  function send_envelope (line 13) | pub async fn send_envelope<T: CdrsTransport + 'static, CM: ConnectionMan...

FILE: cdrs-tokio/src/cluster/session.rs
  constant DEFAULT_TRANSPORT_BUFFER_SIZE (line 60) | pub const DEFAULT_TRANSPORT_BUFFER_SIZE: usize = 1024;
  constant DEFAULT_EVENT_CHANNEL_CAPACITY (line 61) | const DEFAULT_EVENT_CHANNEL_CAPACITY: usize = 128;
  constant MAX_REPREPARE_ATTEMPTS (line 68) | const MAX_REPREPARE_ATTEMPTS: usize = 5;
  function convert_to_prepared (line 73) | fn convert_to_prepared(body: ResponseBody) -> error::Result<BodyResResul...
  function prepare_flags (line 79) | fn prepare_flags(with_tracing: bool, with_warnings: bool, beta_protocol:...
  function create_keyspace_holder (line 97) | fn create_keyspace_holder() -> (Arc<KeyspaceHolder>, watch::Receiver<Opt...
  function verify_compression_configuration (line 105) | fn verify_compression_configuration(
  function serialize_routing_value (line 117) | fn serialize_routing_value(cursor: &mut Cursor<&mut Vec<u8>>, value: &Ve...
  function serialize_routing_key_with_indexes (line 138) | fn serialize_routing_key_with_indexes(
  function serialize_routing_key (line 172) | fn serialize_routing_key(values: &[Value], version: Version) -> Vec<u8> {
  type Session (line 198) | pub struct Session<
  method drop (line 227) | fn drop(&mut self) {
  function paged (line 239) | pub fn paged(&self, page_size: i32) -> SessionPager<'_, T, CM, LB> {
  function exec_with_params (line 244) | pub fn exec_with_params<'a, 'b: 'a>(
  function exec_with_values (line 371) | pub async fn exec_with_values<V: Into<QueryValues>>(
  function exec (line 387) | pub async fn exec(&self, prepared: &PreparedQuery) -> error::Result<Enve...
  function prepare_raw_tw (line 396) | pub async fn prepare_raw_tw<Q: ToString>(
  function prepare_raw_tw_with_query_plan (line 420) | pub async fn prepare_raw_tw_with_query_plan<Q: ToString>(
  function prepare_raw (line 456) | pub async fn prepare_raw<Q: ToString>(&self, query: Q) -> error::Result<...
  function prepare_tw (line 464) | pub async fn prepare_tw<Q: ToString>(
  function prepare (line 490) | pub async fn prepare<Q: ToString>(&self, query: Q) -> error::Result<Prep...
  function batch (line 496) | pub async fn batch(&self, batch: QueryBatch) -> error::Result<Envelope> {
  function batch_with_params (line 502) | pub fn batch_with_params<'a, 'b: 'a>(
  function reprepare (line 579) | async fn reprepare(
  function query (line 633) | pub async fn query<Q: ToString>(&self, query: Q) -> error::Result<Envelo...
  function query_with_values (line 640) | pub async fn query_with_values<Q: ToString, V: Into<QueryValues>>(
  function query_with_params (line 655) | pub async fn query_with_params<Q: ToString>(
  function current_keyspace (line 697) | pub fn current_keyspace(&self) -> Option<Arc<String>> {
  function cluster_metadata (line 703) | pub fn cluster_metadata(&self) -> Arc<ClusterMetadata<T, CM>> {
  function query_plan (line 710) | pub fn query_plan(&self, request: Option<Request>) -> QueryPlan<T, CM> {
  function create_event_receiver (line 717) | pub fn create_event_receiver(&self) -> Receiver<ServerEvent> {
  function retry_policy (line 723) | pub fn retry_policy(&self) -> &dyn RetryPolicy {
  function send_envelope (line 733) | async fn send_envelope(
  function effective_retry_policy (line 870) | fn effective_retry_policy<'a, 'b: 'a>(
  function new (line 880) | async fn new(
  type RetryPolicyWrapper (line 984) | pub struct RetryPolicyWrapper(pub Box<dyn RetryPolicy + Send + Sync>);
  type ReconnectionPolicyWrapper (line 988) | pub struct ReconnectionPolicyWrapper(pub Arc<dyn ReconnectionPolicy + Se...
  type NodeDistanceEvaluatorWrapper (line 992) | pub struct NodeDistanceEvaluatorWrapper(pub Box<dyn NodeDistanceEvaluato...
  type SpeculativeExecutionPolicyWrapper (line 996) | pub struct SpeculativeExecutionPolicyWrapper(pub Box<dyn SpeculativeExec...
  function connect_generic (line 1005) | pub async fn connect_generic<T, C, A, CM, LB>(
  type SessionConfig (line 1042) | struct SessionConfig<
  function new (line 1068) | fn new(load_balancing: LB) -> Self {
  function into_session (line 1086) | async fn into_session(
  type SessionBuildError (line 1120) | pub enum SessionBuildError {
  type SessionBuilder (line 1130) | pub trait SessionBuilder<
    method with_compression (line 1138) | fn with_compression(self, compression: Compression) -> Self;
    method with_retry_policy (line 1142) | fn with_retry_policy(self, retry_policy: Box<dyn RetryPolicy + Send + ...
    method with_reconnection_policy (line 1146) | fn with_reconnection_policy(
    method with_frame_encoder_factory (line 1153) | fn with_frame_encoder_factory(
    method with_node_distance_evaluator (line 1161) | fn with_node_distance_evaluator(
    method with_speculative_execution_policy (line 1168) | fn with_speculative_execution_policy(
    method with_transport_buffer_size (line 1176) | fn with_transport_buffer_size(self, transport_buffer_size: usize) -> S...
    method with_tcp_nodelay (line 1180) | fn with_tcp_nodelay(self, tcp_nodelay: bool) -> Self;
    method with_event_channel_capacity (line 1185) | fn with_event_channel_capacity(self, event_channel_capacity: usize) ->...
    method with_connection_pool_config (line 1189) | fn with_connection_pool_config(self, connection_pool_config: Connectio...
    method with_keyspace (line 1198) | fn with_keyspace(self, keyspace: String) -> Self;
    method with_beta_protocol (line 1203) | fn with_beta_protocol(self, beta_protocol: bool) -> Self;
    method build (line 1206) | fn build(self) -> BoxFuture<'static, Result<Session<T, CM, LB>, Sessio...
  type TcpSessionBuilder (line 1210) | pub struct TcpSessionBuilder<
  function new (line 1223) | pub fn new(load_balancing: LB, node_config: NodeTcpConfig) -> Self {
  function with_compression (line 1235) | fn with_compression(mut self, compression: Compression) -> Self {
  function with_retry_policy (line 1240) | fn with_retry_policy(mut self, retry_policy: Box<dyn RetryPolicy + Send ...
  function with_reconnection_policy (line 1245) | fn with_reconnection_policy(
  function with_frame_encoder_factory (line 1253) | fn with_frame_encoder_factory(
  function with_node_distance_evaluator (line 1261) | fn with_node_distance_evaluator(
  function with_speculative_execution_policy (line 1269) | fn with_speculative_execution_policy(
  function with_transport_buffer_size (line 1277) | fn with_transport_buffer_size(mut self, transport_buffer_size: usize) ->...
  function with_tcp_nodelay (line 1282) | fn with_tcp_nodelay(mut self, tcp_nodelay: bool) -> Self {
  function with_event_channel_capacity (line 1287) | fn with_event_channel_capacity(mut self, event_channel_capacity: usize) ...
  function with_connection_pool_config (line 1292) | fn with_connection_pool_config(mut self, connection_pool_config: Connect...
  function with_keyspace (line 1297) | fn with_keyspace(mut self, keyspace: String) -> Self {
  function with_beta_protocol (line 1302) | fn with_beta_protocol(mut self, beta_protocol: bool) -> Self {
  function build (line 1307) | fn build(
  type RustlsSessionBuilder (line 1352) | pub struct RustlsSessionBuilder<
  function new (line 1366) | pub fn new(load_balancing: LB, node_config: NodeRustlsConfig) -> Self {
  function with_compression (line 1380) | fn with_compression(mut self, compression: Compression) -> Self {
  function with_retry_policy (line 1385) | fn with_retry_policy(mut self, retry_policy: Box<dyn RetryPolicy + Send ...
  function with_reconnection_policy (line 1390) | fn with_reconnection_policy(
  function with_frame_encoder_factory (line 1398) | fn with_frame_encoder_factory(
  function with_node_distance_evaluator (line 1406) | fn with_node_distance_evaluator(
  function with_speculative_execution_policy (line 1414) | fn with_speculative_execution_policy(
  function with_transport_buffer_size (line 1422) | fn with_transport_buffer_size(mut self, transport_buffer_size: usize) ->...
  function with_tcp_nodelay (line 1427) | fn with_tcp_nodelay(mut self, tcp_nodelay: bool) -> Self {
  function with_event_channel_capacity (line 1432) | fn with_event_channel_capacity(mut self, event_channel_capacity: usize) ...
  function with_connection_pool_config (line 1437) | fn with_connection_pool_config(mut self, connection_pool_config: Connect...
  function with_keyspace (line 1442) | fn with_keyspace(mut self, keyspace: String) -> Self {
  function with_beta_protocol (line 1447) | fn with_beta_protocol(mut self, beta_protocol: bool) -> Self {
  function build (line 1452) | fn build(
  type AbortOnDropHandle (line 1506) | struct AbortOnDropHandle(Option<JoinHandle<()>>);
    method new (line 1509) | fn new(handle: JoinHandle<()>) -> Self {
    method into_inner (line 1516) | fn into_inner(mut self) -> JoinHandle<()> {
  method drop (line 1524) | fn drop(&mut self) {
  function prepare_flags_test (line 1538) | fn prepare_flags_test() {
  function abort_on_drop_handle_aborts_when_dropped (line 1553) | async fn abort_on_drop_handle_aborts_when_dropped() {
  function abort_on_drop_handle_does_not_abort_when_released (line 1582) | async fn abort_on_drop_handle_does_not_abort_when_released() {

FILE: cdrs-tokio/src/cluster/session_context.rs
  type SessionContext (line 4) | pub struct SessionContext<T: CdrsTransport> {
  method default (line 9) | fn default() -> Self {

FILE: cdrs-tokio/src/cluster/tcp_connection_manager.rs
  type TcpConnectionManager (line 25) | pub struct TcpConnectionManager {
    method connection (line 39) | fn connection(
    method new (line 52) | pub fn new(
    method create_transport (line 77) | async fn create_transport(
    method create_transport (line 136) | async fn create_transport(
    method establish_connection (line 158) | async fn establish_connection(

FILE: cdrs-tokio/src/cluster/token_map.rs
  type TokenMap (line 12) | pub struct TokenMap<T: CdrsTransport + 'static, CM: ConnectionManager<T>...
  method clone (line 17) | fn clone(&self) -> Self {
  method fmt (line 25) | fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
  method default (line 33) | fn default() -> Self {
  function new (line 41) | pub fn new(nodes: &NodeMap<T, CM>) -> Self {
  function nodes_for_token_capped (line 61) | pub fn nodes_for_token_capped(
  function nodes_for_token (line 95) | pub fn nodes_for_token(
  function clone_with_node (line 114) | pub fn clone_with_node(&self, node: Arc<Node<T, CM>>) -> Self {
  function clone_without_node (line 125) | pub fn clone_without_node(&self, broadcast_rpc_address: SocketAddr) -> S...
  function prepare_nodes (line 163) | fn prepare_nodes() -> NodeMap<MockCdrsTransport, MockConnectionManager<M...
  function verify_tokens (line 229) | fn verify_tokens(host_ids: &[Uuid], token: Murmur3Token) {
  function should_return_replicas_in_order (line 242) | fn should_return_replicas_in_order() {
  function should_return_replicas_in_order_for_non_primary_token (line 250) | fn should_return_replicas_in_order_for_non_primary_token() {
  function should_return_distinct_nodes_as_replicas (line 261) | fn should_return_distinct_nodes_as_replicas() {
  function should_cap_replica_count_when_smaller_than_distinct_nodes (line 274) | fn should_cap_replica_count_when_smaller_than_distinct_nodes() {
  function should_return_replicas_in_a_ring (line 287) | fn should_return_replicas_in_a_ring() {

FILE: cdrs-tokio/src/cluster/topology.rs
  type NodeMap (line 22) | pub type NodeMap<T, CM> = FxHashMap<Uuid, Arc<Node<T, CM>>>;

FILE: cdrs-tokio/src/cluster/topology/cluster_metadata.rs
  function build_datacenter_info (line 13) | fn build_datacenter_info<T: CdrsTransport, CM: ConnectionManager<T>>(
  type ClusterMetadata (line 34) | pub struct ClusterMetadata<T: CdrsTransport + 'static, CM: ConnectionMan...
  function new (line 42) | pub fn new(nodes: NodeMap<T, CM>, keyspaces: FxHashMap<String, KeyspaceM...
  function token_map (line 55) | pub fn token_map(&self) -> &TokenMap<T, CM> {
  function clone_with_keyspace (line 61) | pub fn clone_with_keyspace(&self, keyspace_name: String, keyspace: Keysp...
  function clone_without_keyspace (line 75) | pub fn clone_without_keyspace(&self, keyspace: &str) -> Self {
  function clone_with_node (line 89) | pub fn clone_with_node(&self, node: Node<T, CM>) -> Self {
  function clone_without_node (line 111) | pub fn clone_without_node(&self, broadcast_rpc_address: SocketAddr) -> S...
  function nodes (line 129) | pub fn nodes(&self) -> &NodeMap<T, CM> {
  function keyspaces (line 135) | pub fn keyspaces(&self) -> &FxHashMap<String, KeyspaceMetadata> {
  function keyspace (line 141) | pub fn keyspace(&self, keyspace: &str) -> Option<&KeyspaceMetadata> {
  function datacenters (line 147) | pub fn datacenters(&self) -> &FxHashMap<String, DatacenterMetadata> {
  function datacenter (line 153) | pub fn datacenter(&self, name: &str) -> Option<&DatacenterMetadata> {
  function unignored_nodes (line 159) | pub fn unignored_nodes(&self) -> Vec<Arc<Node<T, CM>>> {
  function unignored_local_nodes (line 174) | pub fn unignored_local_nodes(&self) -> Vec<Arc<Node<T, CM>>> {
  function unignored_remote_nodes_capped (line 189) | pub fn unignored_remote_nodes_capped(&self, max_count: usize) -> Vec<Arc...
  function has_nodes (line 205) | pub fn has_nodes(&self) -> bool {
  function has_node_by_rpc_address (line 211) | pub fn has_node_by_rpc_address(&self, broadcast_rpc_address: SocketAddr)...
  function find_node_by_rpc_address (line 219) | pub fn find_node_by_rpc_address(
  function find_node_by_host_id (line 231) | pub fn find_node_by_host_id(&self, host_id: &Uuid) -> Option<Arc<Node<T,...
  method default (line 237) | fn default() -> Self {
  function should_build_datacenter_info (line 265) | fn should_build_datacenter_info() {

FILE: cdrs-tokio/src/cluster/topology/datacenter_metadata.rs
  type DatacenterMetadata (line 5) | pub struct DatacenterMetadata {

FILE: cdrs-tokio/src/cluster/topology/keyspace_metadata.rs
  type KeyspaceMetadata (line 7) | pub struct KeyspaceMetadata {

FILE: cdrs-tokio/src/cluster/topology/node.rs
  type Node (line 20) | pub struct Node<T: CdrsTransport + 'static, CM: ConnectionManager<T> + '...
  method fmt (line 34) | fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
  function new (line 50) | pub(crate) fn new(
  function new_with_state (line 75) | pub(crate) fn new_with_state(
  function with_state (line 101) | pub(crate) fn with_state(
  function with_distance (line 126) | pub(crate) fn with_distance(
  function state (line 148) | pub fn state(&self) -> NodeState {
  function host_id (line 155) | pub fn host_id(&self) -> Option<Uuid> {
  function broadcast_rpc_address (line 162) | pub fn broadcast_rpc_address(&self) -> SocketAddr {
  function broadcast_address (line 169) | pub fn broadcast_address(&self) -> Option<SocketAddr> {
  function tokens (line 175) | pub fn tokens(&self) -> &[Murmur3Token] {
  function datacenter (line 181) | pub fn datacenter(&self) -> &str {
  function rack (line 187) | pub fn rack(&self) -> &str {
  function persistent_connection (line 193) | pub async fn persistent_connection(self: &Arc<Self>) -> Result<Arc<T>> {
  function is_any_connection_up (line 221) | pub async fn is_any_connection_up(&self) -> bool {
  function new_connection (line 230) | pub async fn new_connection(
  function distance (line 244) | pub fn distance(&self) -> Option<NodeDistance> {
  function is_local (line 250) | pub fn is_local(&self) -> bool {
  function is_remote (line 256) | pub fn is_remote(&self) -> bool {
  function is_ignored (line 262) | pub fn is_ignored(&self) -> bool {
  function force_down (line 266) | pub(crate) fn force_down(&self) {
  function mark_down (line 270) | pub(crate) fn mark_down(&self) {
  function mark_up (line 274) | pub(crate) fn mark_up(&self) {
  function clone_with_node_info (line 279) | pub(crate) fn clone_with_node_info(&self, node_info: NodeInfo) -> Self {
  function clone_as_contact_point (line 323) | pub(crate) fn clone_as_contact_point(&self, node_info: NodeInfo) -> Self {
  function clone_with_node_info_and_state (line 340) | pub(crate) fn clone_with_node_info_and_state(
  function clone_with_node_state (line 361) | pub(crate) fn clone_with_node_state(&self, state: NodeState) -> Self {

FILE: cdrs-tokio/src/cluster/topology/node_distance.rs
  type NodeDistance (line 5) | pub enum NodeDistance {

FILE: cdrs-tokio/src/cluster/topology/node_state.rs
  type NodeState (line 7) | pub enum NodeState {

FILE: cdrs-tokio/src/cluster/topology/replication_strategy.rs
  type ReplicationStrategy (line 5) | pub enum ReplicationStrategy {

FILE: cdrs-tokio/src/envelope_parser.rs
  constant MAX_ENVELOPE_BODY_SIZE (line 22) | const MAX_ENVELOPE_BODY_SIZE: usize = 256 * 1024 * 1024;
  function parse_raw_envelope (line 24) | async fn parse_raw_envelope<T: AsyncReadExt + Unpin>(
  function parse_envelope (line 120) | pub async fn parse_envelope<T: AsyncReadExt + Unpin>(
  function convert_envelope_into_result (line 129) | pub(crate) fn convert_envelope_into_result(
  function header_with_length (line 156) | fn header_with_length(length_bytes: [u8; 4]) -> Vec<u8> {
  function parse_envelope_rejects_negative_body_length (line 169) | async fn parse_envelope_rejects_negative_body_length() {
  function parse_envelope_rejects_oversized_body_length (line 186) | async fn parse_envelope_rejects_oversized_body_length() {
  function parse_envelope_does_not_read_tracing_id_for_request_direction (line 205) | async fn parse_envelope_does_not_read_tracing_id_for_request_direction() {

FILE: cdrs-tokio/src/frame_encoding.rs
  type FrameEncodingFactory (line 11) | pub trait FrameEncodingFactory {
    method create_encoder (line 13) | fn create_encoder(
    method create_decoder (line 20) | fn create_decoder(
    method create_encoder (line 32) | fn create_encoder(
    method create_decoder (line 48) | fn create_decoder(
  type ProtocolFrameEncodingFactory (line 29) | pub struct ProtocolFrameEncodingFactory;

FILE: cdrs-tokio/src/future.rs
  type BoxFuture (line 3) | pub type BoxFuture<'a, T> = futures::future::BoxFuture<'a, T>;

FILE: cdrs-tokio/src/lib.rs
  type Error (line 65) | pub type Error = error::Error;
  type Result (line 66) | pub type Result<T> = error::Result<T>;

FILE: cdrs-tokio/src/load_balancing.rs
  type QueryPlan (line 20) | pub struct QueryPlan<T: CdrsTransport + 'static, CM: ConnectionManager<T...
  method clone (line 25) | fn clone(&self) -> Self {
  type LoadBalancingStrategy (line 31) | pub trait LoadBalancingStrategy<T: CdrsTransport, CM: ConnectionManager<...
    method query_plan (line 34) | fn query_plan(

FILE: cdrs-tokio/src/load_balancing/initializing_wrapper.rs
  type InitializingWrapperLoadBalancingStrategy (line 9) | pub struct InitializingWrapperLoadBalancingStrategy<
  function query_plan (line 21) | fn query_plan(
  function new (line 37) | pub fn new(inner: LB, contact_points: Vec<Arc<Node<T, CM>>>) -> Self {

FILE: cdrs-tokio/src/load_balancing/node_distance_evaluator.rs
  type NodeDistanceEvaluator (line 9) | pub trait NodeDistanceEvaluator {
    method compute_distance (line 13) | fn compute_distance(&self, node: &NodeInfo) -> Option<NodeDistance>;
    method compute_distance (line 21) | fn compute_distance(&self, _node: &NodeInfo) -> Option<NodeDistance> {
    method compute_distance (line 35) | fn compute_distance(&self, node: &NodeInfo) -> Option<NodeDistance> {
  type AllLocalNodeDistanceEvaluator (line 18) | pub struct AllLocalNodeDistanceEvaluator;
  type TopologyAwareNodeDistanceEvaluator (line 30) | pub struct TopologyAwareNodeDistanceEvaluator {
    method new (line 46) | pub fn new(local_dc: String) -> Self {
  function should_return_topology_aware_distance (line 63) | fn should_return_topology_aware_distance() {

FILE: cdrs-tokio/src/load_balancing/random.rs
  type RandomLoadBalancingStrategy (line 14) | pub struct RandomLoadBalancingStrategy<T: CdrsTransport, CM: ConnectionM...
  function new (line 22) | pub fn new() -> Self {
  function query_plan (line 33) | fn query_plan(

FILE: cdrs-tokio/src/load_balancing/request.rs
  type Request (line 8) | pub struct Request<'a> {

FILE: cdrs-tokio/src/load_balancing/round_robin.rs
  type RoundRobinLoadBalancingStrategy (line 12) | pub struct RoundRobinLoadBalancingStrategy<T: CdrsTransport, CM: Connect...
  function new (line 21) | pub fn new() -> Self {
  function query_plan (line 33) | fn query_plan(

FILE: cdrs-tokio/src/load_balancing/topology_aware.rs
  type TopologyAwareLoadBalancingStrategy (line 32) | pub struct TopologyAwareLoadBalancingStrategy<T: CdrsTransport, CM: Conn...
  function query_plan (line 45) | fn query_plan(
  function new (line 63) | pub fn new(
  function replicas_for_request (line 76) | fn replicas_for_request(
  function replicas_for_token (line 92) | fn replicas_for_token(
  function replicas_for_keyspace (line 105) | fn replicas_for_keyspace(
  function network_topology_strategy_replicas (line 128) | fn network_topology_strategy_replicas(
  function simple_strategy_replicas (line 258) | fn simple_strategy_replicas(
  function round_robin_unignored_nodes (line 288) | fn round_robin_unignored_nodes(
  function round_robin_unignored_local_nodes (line 303) | fn round_robin_unignored_local_nodes(
  function create_cluster (line 348) | fn create_cluster(
  function should_return_nodes_without_request (line 497) | fn should_return_nodes_without_request() {
  function should_return_local_nodes_without_request (line 510) | fn should_return_local_nodes_without_request() {
  function should_return_local_nodes_without_token (line 523) | fn should_return_local_nodes_without_token() {
  function should_return_local_nodes_without_keyspace (line 536) | fn should_return_local_nodes_without_keyspace() {
  function should_return_all_nodes_with_unknown_strategy (line 552) | fn should_return_all_nodes_with_unknown_strategy() {
  function should_return_replica_nodes_with_simple_strategy (line 570) | fn should_return_replica_nodes_with_simple_strategy() {
  function simple_strategy_uses_unignored_nodes_when_ring_starts_on_ignored (line 610) | fn simple_strategy_uses_unignored_nodes_when_ring_starts_on_ignored() {
  function should_return_topology_aware_nodes_with_network_topology_strategy_with_repeated_racks (line 651) | fn should_return_topology_aware_nodes_with_network_topology_strategy_wit...
  function should_return_topology_aware_nodes_with_network_topology_strategy (line 684) | fn should_return_topology_aware_nodes_with_network_topology_strategy() {
  function should_return_topology_aware_nodes_with_network_topology_strategy_with_remote (line 712) | fn should_return_topology_aware_nodes_with_network_topology_strategy_wit...

FILE: cdrs-tokio/src/retry/reconnection_policy.rs
  constant DEFAULT_BASE_DELAY (line 7) | const DEFAULT_BASE_DELAY: Duration = Duration::from_secs(1);
  constant DEFAULT_MAX_DELAY (line 8) | const DEFAULT_MAX_DELAY: Duration = Duration::from_secs(60);
  type ReconnectionSchedule (line 11) | pub trait ReconnectionSchedule {
    method next_delay (line 13) | fn next_delay(&mut self) -> Option<Duration>;
    method next_delay (line 47) | fn next_delay(&mut self) -> Option<Duration> {
    method next_delay (line 65) | fn next_delay(&mut self) -> Option<Duration> {
    method next_delay (line 119) | fn next_delay(&mut self) -> Option<Duration> {
  type ReconnectionPolicy (line 18) | pub trait ReconnectionPolicy {
    method new_node_schedule (line 20) | fn new_node_schedule(&self) -> Box<dyn ReconnectionSchedule + Send + S...
    method new_node_schedule (line 36) | fn new_node_schedule(&self) -> Box<dyn ReconnectionSchedule + Send + S...
    method new_node_schedule (line 57) | fn new_node_schedule(&self) -> Box<dyn ReconnectionSchedule + Send + S...
    method new_node_schedule (line 89) | fn new_node_schedule(&self) -> Box<dyn ReconnectionSchedule + Send + S...
  type ConstantReconnectionPolicy (line 25) | pub struct ConstantReconnectionPolicy {
  method default (line 30) | fn default() -> Self {
  type ConstantReconnectionSchedule (line 42) | struct ConstantReconnectionSchedule {
  type NeverReconnectionPolicy (line 54) | pub struct NeverReconnectionPolicy;
  type NeverReconnectionSchedule (line 62) | struct NeverReconnectionSchedule;
  type ExponentialReconnectionPolicy (line 80) | pub struct ExponentialReconnectionPolicy {
  method default (line 99) | fn default() -> Self {
  type ExponentialReconnectionSchedule (line 111) | struct ExponentialReconnectionSchedule {
    method new (line 148) | pub fn new(base_delay: Duration, max_delay: Duration, max_attempts: us...
  function should_reach_max_exponential_delay_without_panic (line 164) | fn should_reach_max_exponential_delay_without_panic() {
  function saturated_schedule_keeps_returning_max_delay (line 180) | fn saturated_schedule_keeps_returning_max_delay() {

FILE: cdrs-tokio/src/retry/retry_policy.rs
  type RetryDecision (line 9) | pub enum RetryDecision {
  type QueryInfo (line 16) | pub struct QueryInfo<'a> {
  type RetrySession (line 22) | pub trait RetrySession {
    method decide (line 24) | fn decide(&mut self, query_info: QueryInfo) -> RetryDecision;
    method decide (line 47) | fn decide(&mut self, _query_info: QueryInfo) -> RetryDecision {
    method decide (line 71) | fn decide(&mut self, query_info: QueryInfo) -> RetryDecision {
  type RetryPolicy (line 28) | pub trait RetryPolicy {
    method new_session (line 30) | fn new_session(&self) -> Box<dyn RetrySession + Send + Sync>;
    method new_session (line 38) | fn new_session(&self) -> Box<dyn RetrySession + Send + Sync> {
    method new_session (line 58) | fn new_session(&self) -> Box<dyn RetrySession + Send + Sync> {
  type FallthroughRetryPolicy (line 35) | pub struct FallthroughRetryPolicy;
  type FallthroughRetrySession (line 44) | pub struct FallthroughRetrySession;
  type DefaultRetryPolicy (line 55) | pub struct DefaultRetryPolicy;
  type DefaultRetrySession (line 64) | pub struct DefaultRetrySession {

FILE: cdrs-tokio/src/speculative_execution.rs
  type Context (line 18) | pub struct Context {
  type SpeculativeExecutionPolicy (line 26) | pub trait SpeculativeExecutionPolicy {
    method execution_interval (line 29) | fn execution_interval(&self, context: &Context) -> Option<Duration>;
    method execution_interval (line 41) | fn execution_interval(&self, context: &Context) -> Option<Duration> {
  type ConstantSpeculativeExecutionPolicy (line 35) | pub struct ConstantSpeculativeExecutionPolicy {

FILE: cdrs-tokio/src/statement/statement_params.rs
  type StatementParams (line 13) | pub struct StatementParams {

FILE: cdrs-tokio/src/statement/statement_params_builder.rs
  type StatementParamsBuilder (line 15) | pub struct StatementParamsBuilder {
    method new (line 39) | pub fn new() -> StatementParamsBuilder {
    method with_consistency (line 45) | pub fn with_consistency(mut self, consistency: Consistency) -> Self {
    method with_flags (line 52) | pub fn with_flags(mut self, flags: QueryFlags) -> Self {
    method with_values (line 59) | pub fn with_values(mut self, values: QueryValues) -> Self {
    method with_names (line 75) | pub fn with_names(mut self, with_names: bool) -> Self {
    method with_page_size (line 82) | pub fn with_page_size(mut self, size: i32) -> Self {
    method with_paging_state (line 91) | pub fn with_paging_state(mut self, state: CBytes) -> Self {
    method with_serial_consistency (line 100) | pub fn with_serial_consistency(mut self, serial_consistency: Consisten...
    method with_timestamp (line 107) | pub fn with_timestamp(mut self, timestamp: i64) -> Self {
    method with_keyspace (line 114) | pub fn with_keyspace(mut self, keyspace: String) -> Self {
    method with_token (line 121) | pub fn with_token(mut self, token: Murmur3Token) -> Self {
    method with_routing_key (line 128) | pub fn with_routing_key(mut self, routing_key: Vec<Value>) -> Self {
    method idempotent (line 135) | pub fn idempotent(mut self, value: bool) -> Self {
    method with_speculative_execution_policy (line 142) | pub fn with_speculative_execution_policy(
    method with_retry_policy (line 152) | pub fn with_retry_policy(mut self, retry_policy: Arc<dyn RetryPolicy +...
    method with_beta_protocol (line 159) | pub fn with_beta_protocol(mut self, beta_protocol: bool) -> Self {
    method with_now_in_seconds (line 166) | pub fn with_now_in_seconds(mut self, now_in_seconds: CInt) -> Self {
    method build (line 172) | pub fn build(self) -> StatementParams {

FILE: cdrs-tokio/src/transport.rs
  constant INITIAL_STREAM_ID (line 50) | const INITIAL_STREAM_ID: i16 = 1;
  type CdrsTransport (line 53) | pub trait CdrsTransport: Send + Sync {
    method write_envelope (line 56) | fn write_envelope<'a>(
    method is_broken (line 63) | fn is_broken(&self) -> bool;
    method address (line 66) | fn address(&self) -> SocketAddr;
    method write_envelope (line 155) | fn write_envelope<'a>(
    method is_broken (line 164) | fn is_broken(&self) -> bool {
    method address (line 169) | fn address(&self) -> SocketAddr {
    method write_envelope (line 254) | fn write_envelope<'a>(
    method is_broken (line 263) | fn is_broken(&self) -> bool {
    method address (line 268) | fn address(&self) -> SocketAddr {
  type TransportTcp (line 89) | pub struct TransportTcp {
    method new (line 95) | pub async fn new(
    method with_stream (line 123) | pub fn with_stream<T: AsyncRead + AsyncWrite + Send + Sync + 'static>(
  type TransportRustls (line 176) | pub struct TransportRustls {
    method new (line 183) | pub async fn new(
    method with_stream (line 216) | pub async fn with_stream<T: AsyncRead + AsyncWrite + Send + Sync + Unp...
  type AsyncTransport (line 274) | struct AsyncTransport {
    method new (line 290) | fn new<T: AsyncRead + AsyncWrite + Send + 'static>(
    method is_broken (line 329) | fn is_broken(&self) -> bool {
    method addr (line 334) | fn addr(&self) -> SocketAddr {
    method write_envelope (line 338) | async fn write_envelope(&self, envelope: &Envelope, handshake: bool) -...
    method start_processing (line 361) | async fn start_processing<T: AsyncRead + AsyncWrite>(
    method start_reading_handshake_frames (line 409) | async fn start_reading_handshake_frames(
    method start_reading_normal_frames (line 452) | async fn start_reading_normal_frames(
    method start_writing (line 506) | async fn start_writing(
    method write_self_contained_frame (line 606) | async fn write_self_contained_frame(
    method write_frame (line 632) | async fn write_frame(
    method notify_error_handlers (line 656) | fn notify_error_handlers(
  method drop (line 283) | fn drop(&mut self) {
  type ResponseHandler (line 668) | type ResponseHandler = oneshot::Sender<Result<Envelope>>;
  type ResponseHandlerMap (line 670) | struct ResponseHandlerMap {
    method new (line 677) | pub fn new() -> Self {
    method add_handler (line 685) | pub fn add_handler(&self, stream_id: StreamId, handler: ResponseHandle...
    method send_response (line 692) | pub fn send_response(&self, stream_id: StreamId, response: Result<Enve...
    method signal_general_error (line 703) | pub fn signal_general_error(&self, error: &Error) {
    method next_stream_id (line 709) | pub fn next_stream_id(&self) -> StreamId {
  type Request (line 762) | struct Request {
    method set_stream_id (line 770) | fn set_stream_id(&mut self, stream_d: StreamId) {
  function write_self_contained_frame_clears_stream_ids_on_success (line 787) | async fn write_self_contained_frame_clears_stream_ids_on_success() {
  function next_stream_id_starts_at_initial_value (line 825) | fn next_stream_id_starts_at_initial_value() {
  function next_stream_id_wraps_to_initial_after_overflow (line 832) | fn next_stream_id_wraps_to_initial_after_overflow() {

FILE: cdrs-tokio/tests/collection_types.rs
  function list_v4 (line 30) | async fn list_v4() {
  function list_v5 (line 41) | async fn list_v5() {
  function list_test (line 51) | async fn list_test(session: CurrentSession) {
  function list_advanced_v4 (line 100) | async fn list_advanced_v4() {
  function list_advanced_v5 (line 111) | async fn list_advanced_v5() {
  function list_advanced_test (line 121) | async fn list_advanced_test(session: CurrentSession) {
  function set_v4 (line 174) | async fn set_v4() {
  function set_v5 (line 185) | async fn set_v5() {
  function set_test (line 195) | async fn set_test(session: CurrentSession) {
  function set_advanced_v4 (line 248) | async fn set_advanced_v4() {
  function set_advanced_v5 (line 259) | async fn set_advanced_v5() {
  function set_advanced_test (line 269) | async fn set_advanced_test(session: CurrentSession) {
  function map_without_blob_v4 (line 322) | async fn map_without_blob_v4() {
  function map_without_blob_v5 (line 334) | async fn map_without_blob_v5() {
  function map_without_blob_test (line 345) | async fn map_without_blob_test(session: CurrentSession) {
  function map_without_blob_advanced_v4 (line 410) | async fn map_without_blob_advanced_v4() {
  function map_without_blob_advanced_v5 (line 421) | async fn map_without_blob_advanced_v5() {
  function map_without_blob_advanced_test (line 431) | async fn map_without_blob_advanced_test(session: CurrentSession) {
  function map_v4 (line 496) | async fn map_v4() {
  function map_v5 (line 507) | async fn map_v5() {
  function map_test (line 517) | async fn map_test(session: CurrentSession) {

FILE: cdrs-tokio/tests/common.rs
  constant ADDR (line 26) | pub const ADDR: &str = "127.0.0.1:9042";
  type CurrentSession (line 29) | pub type CurrentSession = Session<
  function setup (line 37) | pub async fn setup(create_table_cql: &'static str, version: Version) -> ...
  function setup_multiple (line 42) | pub async fn setup_multiple(

FILE: cdrs-tokio/tests/compression.rs
  function encode_decode_test (line 31) | async fn encode_decode_test(version: Version) {
  function encode_decode_test_v4 (line 97) | async fn encode_decode_test_v4() {
  function encode_decode_test_v5 (line 103) | async fn encode_decode_test_v5() {

FILE: cdrs-tokio/tests/derive_traits.rs
  function simple_udt_v4 (line 37) | async fn simple_udt_v4() {
  function simple_udt_v5 (line 50) | async fn simple_udt_v5() {
  function simple_udt_test (line 62) | async fn simple_udt_test(session: CurrentSession) {
  function nested_udt_v4 (line 117) | async fn nested_udt_v4() {
  function nested_udt_v5 (line 135) | async fn nested_udt_v5() {
  function nested_udt_test (line 152) | async fn nested_udt_test(session: CurrentSession) {
  function alter_udt_add_v4 (line 210) | async fn alter_udt_add_v4() {
  function alter_udt_add_v5 (line 233) | async fn alter_udt_add_v5() {
  function alter_udt_add_test (line 255) | async fn alter_udt_add_test(session: CurrentSession) {
  function update_list_with_udt_v4 (line 327) | async fn update_list_with_udt_v4() {
  function update_list_with_udt_v5 (line 351) | async fn update_list_with_udt_v5() {
  function update_list_with_udt_test (line 374) | async fn update_list_with_udt_test(session: CurrentSession) {

FILE: cdrs-tokio/tests/keyspace.rs
  function create_keyspace (line 25) | async fn create_keyspace() {
  function alter_keyspace (line 99) | async fn alter_keyspace() {
  function use_keyspace (line 164) | async fn use_keyspace() {
  function drop_keyspace (line 202) | async fn drop_keyspace() {

FILE: cdrs-tokio/tests/multi_node_speculative_execution.rs
  function multi_node_speculative_execution (line 27) | async fn multi_node_speculative_execution() {

FILE: cdrs-tokio/tests/multithread.rs
  function multithread (line 16) | async fn multithread() {

FILE: cdrs-tokio/tests/native_types.rs
  function string_v4 (line 34) | async fn string_v4() {
  function string_v5 (line 44) | async fn string_v5() {
  function string_test (line 53) | async fn string_test(session: CurrentSession) {
  function counter_v4 (line 89) | async fn counter_v4() {
  function counter_v5 (line 99) | async fn counter_v5() {
  function counter_test (line 108) | async fn counter_test(session: CurrentSession) {
  function integer_v4 (line 142) | async fn integer_v4() {
  function integer_v5 (line 153) | async fn integer_v5() {
  function integer_test (line 162) | async fn integer_test(session: CurrentSession) {
  function integer_advanced_v4 (line 199) | async fn integer_advanced_v4() {
  function integer_advanced_v5 (line 211) | async fn integer_advanced_v5() {
  function integer_advanced_test (line 221) | async fn integer_advanced_test(session: CurrentSession) {
  function float_v4 (line 263) | async fn float_v4() {
  function float_v5 (line 273) | async fn float_v5() {
  function float_test (line 282) | async fn float_test(session: CurrentSession) {
  function blob_v4 (line 325) | async fn blob_v4() {
  function blob_v5 (line 335) | async fn blob_v5() {
  function blob_test (line 344) | async fn blob_test(session: CurrentSession) {
  function uuid_v4 (line 396) | async fn uuid_v4() {
  function uuid_v5 (line 407) | async fn uuid_v5() {
  function uuid_test (line 416) | async fn uuid_test(session: CurrentSession) {
  function time_v4 (line 446) | async fn time_v4() {
  function time_v5 (line 457) | async fn time_v5() {
  function time_test (line 466) | async fn time_test(session: CurrentSession) {
  function inet_v4 (line 500) | async fn inet_v4() {
  function inet_v5 (line 510) | async fn inet_v5() {
  function inet_test (line 519) | async fn inet_test(session: CurrentSession) {

FILE: cdrs-tokio/tests/paged_query.rs
  function paged_query (line 16) | async fn paged_query() {

FILE: cdrs-tokio/tests/query_values.rs
  function query_values_in_v4 (line 14) | async fn query_values_in_v4() {
  function query_values_in_v5 (line 24) | async fn query_values_in_v5() {
  function query_values_in_test (line 33) | async fn query_values_in_test(cql: &str, session: CurrentSession) {

FILE: cdrs-tokio/tests/single_node_speculative_execution.rs
  function single_node_speculative_execution (line 27) | async fn single_node_speculative_execution() {

FILE: cdrs-tokio/tests/topology_aware.rs
  function query_topology_aware (line 27) | async fn query_topology_aware() {

FILE: cdrs-tokio/tests/tuple_types.rs
  function simple_tuple_v4 (line 36) | async fn simple_tuple_v4() {
  function nested_tuples_v4 (line 100) | async fn nested_tuples_v4() {
  function simple_tuple_v5 (line 218) | async fn simple_tuple_v5() {
  function nested_tuples_v5 (line 282) | async fn nested_tuples_v5() {

FILE: cdrs-tokio/tests/user_defined_types.rs
  type TestStaticStrReference (line 36) | pub struct TestStaticStrReference {
  function simple_udt_v4 (line 42) | async fn simple_udt_v4() {
  function nested_udt_v4 (line 104) | async fn nested_udt_v4() {
  function alter_udt_add_v4 (line 195) | async fn alter_udt_add_v4() {
  function simple_udt_v5 (line 291) | async fn simple_udt_v5() {
  function nested_udt_v5 (line 353) | async fn nested_udt_v5() {
  function alter_udt_add_v5 (line 444) | async fn alter_udt_add_v5() {
Condensed preview — 155 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,057K chars).
[
  {
    "path": ".github/FUNDING.yml",
    "chars": 62,
    "preview": "# These are supported funding model platforms\n\ngithub: krojew\n"
  },
  {
    "path": ".github/dependabot.yml",
    "chars": 431,
    "preview": "# To get started with Dependabot version updates, you'll need to specify which\n# package ecosystems to update and where "
  },
  {
    "path": ".github/stale.yml",
    "chars": 684,
    "preview": "# Number of days of inactivity before an issue becomes stale\ndaysUntilStale: 60\n# Number of days of inactivity before a "
  },
  {
    "path": ".github/workflows/rust.yml",
    "chars": 1009,
    "preview": "name: Continuous integration\n\non: [ push, pull_request ]\n\nenv:\n  CARGO_TERM_COLOR: always\n\njobs:\n  test:\n    name: Test "
  },
  {
    "path": ".gitignore",
    "chars": 48,
    "preview": "Cargo.lock\ntarget\n*.bk\n.idea/\ncdrs.iml\n.vscode/\n"
  },
  {
    "path": "Cargo.toml",
    "chars": 301,
    "preview": "[workspace]\nmembers = [\n    \"cassandra-protocol\",\n    \"cdrs-tokio\",\n    \"cdrs-tokio-helpers-derive\"\n]\n\n[workspace.depend"
  },
  {
    "path": "LICENSE-APACHE",
    "chars": 10843,
    "preview": "                              Apache License\n                        Version 2.0, January 2004\n                     http"
  },
  {
    "path": "LICENSE-MIT",
    "chars": 1090,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2016 CDRS Project Developers\n\nPermission is hereby granted, free of charge, to any "
  },
  {
    "path": "README.md",
    "chars": 3941,
    "preview": "# CDRS tokio\n\n[![crates.io version](https://img.shields.io/crates/v/cdrs-tokio.svg)](https://crates.io/crates/cdrs-tokio"
  },
  {
    "path": "cassandra-ports.txt",
    "chars": 243,
    "preview": "Cassandra ports:\n\n* 7199 - JMX (was 8080 pre Cassandra 0.8.xx)\n* 7000 - Internode communication (not used if TLS enabled"
  },
  {
    "path": "cassandra-protocol/Cargo.toml",
    "chars": 1013,
    "preview": "[package]\nname = \"cassandra-protocol\"\nversion = \"4.0.0\"\nauthors = [\"Alex Pikalov <alex.pikalov.khar@gmail.com>\", \"Kamil "
  },
  {
    "path": "cassandra-protocol/README.md",
    "chars": 470,
    "preview": "# Cassandra protocol [![crates.io version](https://img.shields.io/crates/v/cassandra-protocol.svg)](https://crates.io/cr"
  },
  {
    "path": "cassandra-protocol/src/authenticators.rs",
    "chars": 4499,
    "preview": "use crate::error::Result;\nuse crate::types::CBytes;\n\n/// Handles SASL authentication.\n///\n/// The lifecycle of an authen"
  },
  {
    "path": "cassandra-protocol/src/compression.rs",
    "chars": 12912,
    "preview": "/// CDRS support traffic compression as it is described in [Apache\n/// Cassandra protocol](\n/// https://github.com/apach"
  },
  {
    "path": "cassandra-protocol/src/consistency.rs",
    "chars": 12347,
    "preview": "#![warn(missing_docs)]\n//! The module contains Rust representation of Cassandra consistency levels.\nuse crate::error;\nus"
  },
  {
    "path": "cassandra-protocol/src/crc.rs",
    "chars": 705,
    "preview": "use crc32fast::Hasher;\n\nconst CRC24_POLY: i32 = 0x1974f0b;\nconst CRC24_INIT: i32 = 0x875060;\n\n/// Computes crc24 value o"
  },
  {
    "path": "cassandra-protocol/src/error.rs",
    "chars": 6948,
    "preview": "use crate::compression::CompressionError;\nuse crate::frame::message_error::ErrorBody;\nuse crate::frame::Opcode;\nuse crat"
  },
  {
    "path": "cassandra-protocol/src/events.rs",
    "chars": 520,
    "preview": "use crate::frame::events::{\n    SchemaChange as MessageSchemaChange, ServerEvent as MessageServerEvent,\n    SimpleServer"
  },
  {
    "path": "cassandra-protocol/src/frame/events.rs",
    "chars": 38943,
    "preview": "use crate::frame::traits::FromCursor;\nuse crate::frame::{Serialize, Version};\nuse crate::types::{from_cursor_str, from_c"
  },
  {
    "path": "cassandra-protocol/src/frame/frame_decoder.rs",
    "chars": 18530,
    "preview": "use crate::compression::{Compression, CompressionError};\nuse crate::crc::{crc24, crc32};\nuse crate::error::{Error, Resul"
  },
  {
    "path": "cassandra-protocol/src/frame/frame_encoder.rs",
    "chars": 9208,
    "preview": "use crate::crc::{crc24, crc32};\nuse crate::frame::{\n    COMPRESSED_FRAME_HEADER_LENGTH, FRAME_TRAILER_LENGTH, PAYLOAD_SI"
  },
  {
    "path": "cassandra-protocol/src/frame/message_auth_challenge.rs",
    "chars": 1630,
    "preview": "use super::Serialize;\nuse crate::error;\nuse crate::frame::{FromCursor, Version};\nuse crate::types::CBytes;\nuse std::io::"
  },
  {
    "path": "cassandra-protocol/src/frame/message_auth_response.rs",
    "chars": 2028,
    "preview": "use crate::error;\nuse crate::frame::{Direction, Envelope, Flags, FromCursor, Opcode, Serialize, Version};\nuse crate::typ"
  },
  {
    "path": "cassandra-protocol/src/frame/message_auth_success.rs",
    "chars": 1658,
    "preview": "use super::Serialize;\nuse crate::error;\nuse crate::frame::{FromCursor, Version};\nuse crate::types::CBytes;\nuse std::io::"
  },
  {
    "path": "cassandra-protocol/src/frame/message_authenticate.rs",
    "chars": 1568,
    "preview": "use super::Serialize;\nuse crate::error;\nuse crate::frame::{FromCursor, Version};\nuse crate::types::{from_cursor_str, ser"
  },
  {
    "path": "cassandra-protocol/src/frame/message_batch.rs",
    "chars": 10294,
    "preview": "use crate::consistency::Consistency;\nuse crate::frame::{Direction, Envelope, Flags, FromCursor, Opcode, Serialize, Versi"
  },
  {
    "path": "cassandra-protocol/src/frame/message_error.rs",
    "chars": 28413,
    "preview": "use super::Serialize;\nuse crate::consistency::Consistency;\nuse crate::frame::traits::FromCursor;\nuse crate::frame::Versi"
  },
  {
    "path": "cassandra-protocol/src/frame/message_event.rs",
    "chars": 1790,
    "preview": "use crate::error;\nuse crate::frame::events::ServerEvent;\nuse crate::frame::Serialize;\nuse crate::frame::{FromCursor, Ver"
  },
  {
    "path": "cassandra-protocol/src/frame/message_execute.rs",
    "chars": 4211,
    "preview": "use crate::error;\nuse crate::frame::{Direction, Envelope, Flags, FromCursor, Opcode, Serialize, Version};\nuse crate::que"
  },
  {
    "path": "cassandra-protocol/src/frame/message_options.rs",
    "chars": 1423,
    "preview": "use crate::error;\nuse crate::frame::{Direction, Envelope, Flags, FromCursor, Opcode, Serialize, Version};\nuse std::io::C"
  },
  {
    "path": "cassandra-protocol/src/frame/message_prepare.rs",
    "chars": 4549,
    "preview": "use crate::error;\nuse crate::frame::{Direction, Envelope, Flags, FromCursor, Opcode, Serialize, Version};\nuse crate::que"
  },
  {
    "path": "cassandra-protocol/src/frame/message_query.rs",
    "chars": 3918,
    "preview": "use crate::consistency::Consistency;\nuse crate::error;\nuse crate::frame::traits::FromCursor;\nuse crate::frame::{Directio"
  },
  {
    "path": "cassandra-protocol/src/frame/message_ready.rs",
    "chars": 858,
    "preview": "use crate::error;\nuse crate::frame::{FromCursor, Serialize, Version};\nuse std::io::Cursor;\n\n#[derive(Clone, Debug, Parti"
  },
  {
    "path": "cassandra-protocol/src/frame/message_register.rs",
    "chars": 2326,
    "preview": "use crate::error;\nuse crate::frame::events::SimpleServerEvent;\nuse crate::frame::{Direction, Envelope, Flags, FromCursor"
  },
  {
    "path": "cassandra-protocol/src/frame/message_request.rs",
    "chars": 3079,
    "preview": "use std::io::Cursor;\n\nuse crate::frame::message_auth_response::BodyReqAuthResponse;\nuse crate::frame::message_batch::Bod"
  },
  {
    "path": "cassandra-protocol/src/frame/message_response.rs",
    "chars": 5145,
    "preview": "use std::io::Cursor;\n\nuse crate::frame::message_auth_challenge::BodyResAuthChallenge;\nuse crate::frame::message_auth_suc"
  },
  {
    "path": "cassandra-protocol/src/frame/message_result.rs",
    "chars": 50253,
    "preview": "use crate::error;\nuse crate::error::Error;\nuse crate::frame::events::SchemaChange;\nuse crate::frame::{FromBytes, FromCur"
  },
  {
    "path": "cassandra-protocol/src/frame/message_startup.rs",
    "chars": 4405,
    "preview": "use crate::error;\nuse crate::frame::{Direction, Envelope, Flags, FromCursor, Opcode, Serialize, Version};\nuse crate::typ"
  },
  {
    "path": "cassandra-protocol/src/frame/message_supported.rs",
    "chars": 2476,
    "preview": "use super::Serialize;\nuse crate::error;\nuse crate::frame::{FromCursor, Version};\nuse crate::types::{from_cursor_str, fro"
  },
  {
    "path": "cassandra-protocol/src/frame/traits.rs",
    "chars": 2700,
    "preview": "use crate::error;\nuse crate::frame::Version;\nuse crate::query;\nuse num_bigint::BigInt;\nuse std::io::{Cursor, Write};\n\n//"
  },
  {
    "path": "cassandra-protocol/src/frame.rs",
    "chars": 40860,
    "preview": "use crate::compression::{Compression, CompressionError};\nuse crate::frame::message_request::RequestBody;\nuse crate::fram"
  },
  {
    "path": "cassandra-protocol/src/lib.rs",
    "chars": 406,
    "preview": "//! A generic cassandra protocol crate.\n//! Built in coordination with cdrs-tokio but is flexible for many usecases.\n\nex"
  },
  {
    "path": "cassandra-protocol/src/macros.rs",
    "chars": 69415,
    "preview": "#[macro_export]\n\n/// Transforms arguments to values consumed by queries.\nmacro_rules! query_values {\n    ($($value:expr)"
  },
  {
    "path": "cassandra-protocol/src/query/batch_query_builder.rs",
    "chars": 4354,
    "preview": "use crate::consistency::Consistency;\nuse crate::error::{Error as CError, Result as CResult};\nuse crate::frame::message_b"
  },
  {
    "path": "cassandra-protocol/src/query/prepare_flags.rs",
    "chars": 947,
    "preview": "use bitflags::bitflags;\nuse std::io::{Cursor, Read};\n\nuse crate::error::Result;\nuse crate::frame::{FromCursor, Serialize"
  },
  {
    "path": "cassandra-protocol/src/query/prepared_query.rs",
    "chars": 1573,
    "preview": "use arc_swap::ArcSwapOption;\nuse std::cmp::Ordering;\nuse std::hash::{Hash, Hasher};\n\nuse crate::types::CBytesShort;\n\n#[d"
  },
  {
    "path": "cassandra-protocol/src/query/query_flags.rs",
    "chars": 2154,
    "preview": "use bitflags::bitflags;\nuse std::io::{Cursor, Read};\n\nuse crate::error;\nuse crate::frame::{FromCursor, Serialize, Versio"
  },
  {
    "path": "cassandra-protocol/src/query/query_params.rs",
    "chars": 6428,
    "preview": "use std::collections::HashMap;\nuse std::io::Cursor;\n\nuse crate::consistency::Consistency;\nuse crate::frame::traits::From"
  },
  {
    "path": "cassandra-protocol/src/query/query_params_builder.rs",
    "chars": 3426,
    "preview": "use super::{QueryFlags, QueryParams, QueryValues};\nuse crate::consistency::Consistency;\nuse crate::types::{CBytes, CInt,"
  },
  {
    "path": "cassandra-protocol/src/query/query_values.rs",
    "chars": 2527,
    "preview": "use itertools::Itertools;\nuse std::collections::HashMap;\nuse std::io::Cursor;\n\nuse crate::frame::{Serialize, Version};\nu"
  },
  {
    "path": "cassandra-protocol/src/query/utils.rs",
    "chars": 183,
    "preview": "/// Returns the identifier in a format appropriate for concatenation in a CQL query.\n#[inline]\npub fn quote(text: &str) "
  },
  {
    "path": "cassandra-protocol/src/query.rs",
    "chars": 576,
    "preview": "pub mod batch_query_builder;\npub mod prepare_flags;\npub mod prepared_query;\npub mod query_flags;\npub mod query_params;\np"
  },
  {
    "path": "cassandra-protocol/src/token.rs",
    "chars": 3577,
    "preview": "use crate::error::Error;\nuse bytes::Buf;\nuse derive_more::Constructor;\nuse std::cmp::min;\nuse std::convert::TryFrom;\nuse"
  },
  {
    "path": "cassandra-protocol/src/types/blob.rs",
    "chars": 722,
    "preview": "use derive_more::Constructor;\n\n/// Special type that represents Cassandra blob type.\n#[derive(PartialEq, Eq, Hash, Debug"
  },
  {
    "path": "cassandra-protocol/src/types/cassandra_type.rs",
    "chars": 13015,
    "preview": "use num_bigint::BigInt;\nuse std::collections::HashMap;\nuse std::net::IpAddr;\n\nuse super::prelude::{Blob, Decimal, Durati"
  },
  {
    "path": "cassandra-protocol/src/types/data_serialization_types.rs",
    "chars": 31040,
    "preview": "use integer_encoding::VarInt;\nuse num_bigint::BigInt;\nuse std::convert::TryInto;\nuse std::io;\nuse std::net;\nuse std::str"
  },
  {
    "path": "cassandra-protocol/src/types/decimal.rs",
    "chars": 6827,
    "preview": "use derive_more::Constructor;\nuse float_eq::*;\nuse num_bigint::BigInt;\nuse std::io::Cursor;\n\nuse crate::frame::{Serializ"
  },
  {
    "path": "cassandra-protocol/src/types/duration.rs",
    "chars": 2530,
    "preview": "use integer_encoding::VarInt;\nuse std::io::{Cursor, Write};\nuse thiserror::Error;\n\nuse crate::frame::{Serialize, Version"
  },
  {
    "path": "cassandra-protocol/src/types/from_cdrs.rs",
    "chars": 2693,
    "preview": "use std::net::IpAddr;\nuse std::num::{NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8};\n\nuse chrono::prelude::*;\nuse time::"
  },
  {
    "path": "cassandra-protocol/src/types/list.rs",
    "chars": 1584,
    "preview": "use derive_more::Constructor;\nuse itertools::Itertools;\nuse num_bigint::BigInt;\nuse std::net::IpAddr;\nuse uuid::Uuid;\n\nu"
  },
  {
    "path": "cassandra-protocol/src/types/map.rs",
    "chars": 8435,
    "preview": "use std::collections::HashMap;\nuse std::net::IpAddr;\nuse time::PrimitiveDateTime;\nuse uuid::Uuid;\n\nuse crate::error::{Er"
  },
  {
    "path": "cassandra-protocol/src/types/rows.rs",
    "chars": 4409,
    "preview": "use std::net::IpAddr;\nuse std::num::{NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8};\nuse std::sync::Arc;\n\nuse chrono::pr"
  },
  {
    "path": "cassandra-protocol/src/types/tuple.rs",
    "chars": 2321,
    "preview": "use chrono::prelude::*;\nuse num_bigint::BigInt;\nuse std::hash::{Hash, Hasher};\nuse std::net::IpAddr;\nuse time::Primitive"
  },
  {
    "path": "cassandra-protocol/src/types/udt.rs",
    "chars": 2085,
    "preview": "use std::collections::HashMap;\nuse std::net::IpAddr;\nuse std::num::{NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8};\n\nuse"
  },
  {
    "path": "cassandra-protocol/src/types/value.rs",
    "chars": 11753,
    "preview": "use std::cmp::Eq;\nuse std::collections::{BTreeMap, HashMap};\nuse std::convert::Into;\nuse std::fmt::Debug;\nuse std::hash:"
  },
  {
    "path": "cassandra-protocol/src/types/vector.rs",
    "chars": 2047,
    "preview": "use crate::error::{Error, Result};\nuse crate::frame::message_result::{ColType, ColTypeOption, ColTypeOptionValue};\nuse c"
  },
  {
    "path": "cassandra-protocol/src/types.rs",
    "chars": 17819,
    "preview": "use self::cassandra_type::CassandraType;\nuse crate::error::{column_is_empty_err, Error as CdrsError, Result as CDRSResul"
  },
  {
    "path": "cdrs-tokio/Cargo.toml",
    "chars": 2428,
    "preview": "[package]\nname = \"cdrs-tokio\"\nversion = \"9.0.1\"\nauthors = [\"Alex Pikalov <alex.pikalov.khar@gmail.com>\", \"Kamil Rojewski"
  },
  {
    "path": "cdrs-tokio/examples/README.md",
    "chars": 762,
    "preview": "# CDRS examples\n\n- [`crud_operations.rs`](./crud_operations.rs) demonstrates how to create keyspace, table and user defi"
  },
  {
    "path": "cdrs-tokio/examples/crud_operations.rs",
    "chars": 4696,
    "preview": "#[macro_use]\nextern crate maplit;\nuse cdrs_tokio::authenticators::StaticPasswordAuthenticatorProvider;\nuse cdrs_tokio::c"
  },
  {
    "path": "cdrs-tokio/examples/generic_connection.rs",
    "chars": 9472,
    "preview": "use cdrs_tokio::cluster::connection_pool::ConnectionPoolConfig;\nuse cdrs_tokio::cluster::session::{\n    NodeDistanceEval"
  },
  {
    "path": "cdrs-tokio/examples/insert_collection.rs",
    "chars": 6562,
    "preview": "#[macro_use]\nextern crate maplit;\nuse cdrs_tokio::authenticators::StaticPasswordAuthenticatorProvider;\nuse cdrs_tokio::c"
  },
  {
    "path": "cdrs-tokio/examples/multiple_thread.rs",
    "chars": 3263,
    "preview": "use cdrs_tokio::authenticators::NoneAuthenticatorProvider;\nuse cdrs_tokio::cluster::session::{Session, SessionBuilder, T"
  },
  {
    "path": "cdrs-tokio/examples/paged_query.rs",
    "chars": 7581,
    "preview": "use cdrs_tokio::authenticators::NoneAuthenticatorProvider;\nuse cdrs_tokio::cluster::session::{Session, SessionBuilder, T"
  },
  {
    "path": "cdrs-tokio/examples/prepare_batch_execute.rs",
    "chars": 3247,
    "preview": "use cdrs_tokio::authenticators::NoneAuthenticatorProvider;\nuse cdrs_tokio::cluster::session::{Session, SessionBuilder, T"
  },
  {
    "path": "cdrs-tokio/src/cluster/cluster_metadata_manager.rs",
    "chars": 30164,
    "preview": "use arc_swap::ArcSwap;\nuse cassandra_protocol::error::{Error, Result};\nuse cassandra_protocol::events::{SchemaChange, Se"
  },
  {
    "path": "cdrs-tokio/src/cluster/config_proxy.rs",
    "chars": 1143,
    "preview": "#[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]\npub(crate) struct HttpBasicAuth {\n    pub(crate) username:"
  },
  {
    "path": "cdrs-tokio/src/cluster/config_rustls.rs",
    "chars": 3995,
    "preview": "use cassandra_protocol::authenticators::{NoneAuthenticatorProvider, SaslAuthenticatorProvider};\nuse cassandra_protocol::"
  },
  {
    "path": "cdrs-tokio/src/cluster/config_tcp.rs",
    "chars": 3706,
    "preview": "use cassandra_protocol::authenticators::{NoneAuthenticatorProvider, SaslAuthenticatorProvider};\nuse cassandra_protocol::"
  },
  {
    "path": "cdrs-tokio/src/cluster/connection_manager.rs",
    "chars": 5489,
    "preview": "use std::io;\nuse std::net::SocketAddr;\nuse tokio::sync::mpsc::Sender;\n\n#[cfg(test)]\nuse mockall::*;\n\nuse crate::cluster:"
  },
  {
    "path": "cdrs-tokio/src/cluster/connection_pool.rs",
    "chars": 22873,
    "preview": "use atomic::Atomic;\nuse bytemuck::NoUninit;\nuse cassandra_protocol::frame::{Envelope, Version};\nuse cassandra_protocol::"
  },
  {
    "path": "cdrs-tokio/src/cluster/control_connection.rs",
    "chars": 6820,
    "preview": "use derive_more::Constructor;\nuse std::sync::Arc;\nuse std::time::Duration;\nuse tokio::sync::broadcast::Sender;\nuse tokio"
  },
  {
    "path": "cdrs-tokio/src/cluster/keyspace_holder.rs",
    "chars": 1345,
    "preview": "use std::sync::Arc;\n\nuse arc_swap::ArcSwapOption;\nuse tokio::sync::watch::Sender;\n\n/// Holds currently set global keyspa"
  },
  {
    "path": "cdrs-tokio/src/cluster/metadata_builder.rs",
    "chars": 16583,
    "preview": "use fxhash::{FxHashMap, FxHashSet};\nuse std::collections::hash_map::Entry;\nuse std::sync::Arc;\nuse tracing::*;\n\nuse crat"
  },
  {
    "path": "cdrs-tokio/src/cluster/node_address.rs",
    "chars": 1387,
    "preview": "use derive_more::Display;\nuse std::net::SocketAddr;\nuse tokio::net::lookup_host;\n\nuse cassandra_protocol::error::Result;"
  },
  {
    "path": "cdrs-tokio/src/cluster/node_info.rs",
    "chars": 487,
    "preview": "use derivative::Derivative;\nuse derive_more::Constructor;\nuse std::net::SocketAddr;\nuse uuid::Uuid;\n\nuse crate::cluster:"
  },
  {
    "path": "cdrs-tokio/src/cluster/pager.rs",
    "chars": 7311,
    "preview": "use cassandra_protocol::consistency::Consistency;\nuse cassandra_protocol::error;\nuse cassandra_protocol::frame::message_"
  },
  {
    "path": "cdrs-tokio/src/cluster/rustls_connection_manager.rs",
    "chars": 6483,
    "preview": "use crate::cluster::connection_manager::{startup, ConnectionManager};\n#[cfg(feature = \"http-proxy\")]\nuse crate::cluster:"
  },
  {
    "path": "cdrs-tokio/src/cluster/send_envelope.rs",
    "chars": 1956,
    "preview": "use cassandra_protocol::error;\nuse cassandra_protocol::frame::Envelope;\nuse std::sync::Arc;\n\nuse crate::cluster::topolog"
  },
  {
    "path": "cdrs-tokio/src/cluster/session.rs",
    "chars": 58988,
    "preview": "use arc_swap::ArcSwapOption;\nuse cassandra_protocol::compression::Compression;\nuse cassandra_protocol::consistency::Cons"
  },
  {
    "path": "cdrs-tokio/src/cluster/session_context.rs",
    "chars": 363,
    "preview": "use crate::transport::CdrsTransport;\nuse arc_swap::ArcSwapOption;\n\npub struct SessionContext<T: CdrsTransport> {\n    pub"
  },
  {
    "path": "cdrs-tokio/src/cluster/tcp_connection_manager.rs",
    "chars": 5942,
    "preview": "use crate::cluster::connection_manager::{startup, ConnectionManager};\n#[cfg(feature = \"http-proxy\")]\nuse crate::cluster:"
  },
  {
    "path": "cdrs-tokio/src/cluster/token_map.rs",
    "chars": 10590,
    "preview": "use std::collections::BTreeMap;\nuse std::fmt::{Debug, Formatter};\nuse std::net::SocketAddr;\nuse std::sync::Arc;\n\nuse cra"
  },
  {
    "path": "cdrs-tokio/src/cluster/topology/cluster_metadata.rs",
    "chars": 10279,
    "preview": "use fxhash::FxHashMap;\nuse itertools::Itertools;\nuse std::net::SocketAddr;\nuse std::sync::Arc;\nuse uuid::Uuid;\n\nuse crat"
  },
  {
    "path": "cdrs-tokio/src/cluster/topology/datacenter_metadata.rs",
    "chars": 165,
    "preview": "use derive_more::Constructor;\n\n/// Information about a datacenter.\n#[derive(Clone, Debug, Constructor)]\npub struct Datac"
  },
  {
    "path": "cdrs-tokio/src/cluster/topology/keyspace_metadata.rs",
    "chars": 226,
    "preview": "use derive_more::Constructor;\n\nuse crate::cluster::topology::ReplicationStrategy;\n\n/// Keyspace metadata.\n#[derive(Clone"
  },
  {
    "path": "cdrs-tokio/src/cluster/topology/node.rs",
    "chars": 12772,
    "preview": "use atomic::Atomic;\nuse cassandra_protocol::error::{Error, Result};\nuse cassandra_protocol::frame::Envelope;\nuse std::fm"
  },
  {
    "path": "cdrs-tokio/src/cluster/topology/node_distance.rs",
    "chars": 777,
    "preview": "use derive_more::Display;\n\n/// Determines how the driver will manage connections to a Cassandra node.\n#[derive(Debug, Co"
  },
  {
    "path": "cdrs-tokio/src/cluster/topology/node_state.rs",
    "chars": 1896,
    "preview": "use bytemuck::NoUninit;\nuse derive_more::Display;\n\n/// The state of a node, as viewed from the driver.\n#[derive(Copy, Cl"
  },
  {
    "path": "cdrs-tokio/src/cluster/topology/replication_strategy.rs",
    "chars": 332,
    "preview": "use fxhash::FxHashMap;\n\n/// A replication strategy determines the nodes where replicas are placed.\n#[derive(Debug, Clone"
  },
  {
    "path": "cdrs-tokio/src/cluster/topology.rs",
    "chars": 570,
    "preview": "use std::sync::Arc;\n\nuse fxhash::FxHashMap;\nuse uuid::Uuid;\n\npub mod cluster_metadata;\nmod datacenter_metadata;\nmod keys"
  },
  {
    "path": "cdrs-tokio/src/cluster.rs",
    "chars": 2588,
    "preview": "pub(crate) use self::cluster_metadata_manager::ClusterMetadataManager;\n#[cfg(feature = \"http-proxy\")]\npub use self::conf"
  },
  {
    "path": "cdrs-tokio/src/envelope_parser.rs",
    "chars": 9197,
    "preview": "use std::convert::TryFrom;\nuse std::io;\nuse std::io::Cursor;\nuse std::net::SocketAddr;\nuse tokio::io::AsyncReadExt;\n\nuse"
  },
  {
    "path": "cdrs-tokio/src/frame_encoding.rs",
    "chars": 2132,
    "preview": "use cassandra_protocol::compression::Compression;\nuse cassandra_protocol::frame::frame_decoder::{\n    FrameDecoder, Lega"
  },
  {
    "path": "cdrs-tokio/src/future.rs",
    "chars": 201,
    "preview": "/// An owned dynamically typed `Future` for use in cases where you can't\n/// statically type your result or need to add "
  },
  {
    "path": "cdrs-tokio/src/lib.rs",
    "chars": 2330,
    "preview": "//! **cdrs** is a native Cassandra DB client written in Rust.\n//!\n//! ## Getting started\n//!\n//! This example configures"
  },
  {
    "path": "cdrs-tokio/src/load_balancing/initializing_wrapper.rs",
    "chars": 1406,
    "preview": "use std::sync::Arc;\n\nuse crate::cluster::topology::Node;\nuse crate::cluster::{ClusterMetadata, ConnectionManager};\nuse c"
  },
  {
    "path": "cdrs-tokio/src/load_balancing/node_distance_evaluator.rs",
    "chars": 3214,
    "preview": "#[cfg(test)]\nuse mockall::*;\n\nuse crate::cluster::topology::NodeDistance;\nuse crate::cluster::NodeInfo;\n\n/// A node dist"
  },
  {
    "path": "cdrs-tokio/src/load_balancing/random.rs",
    "chars": 1240,
    "preview": "use derivative::Derivative;\nuse std::marker::PhantomData;\n\nuse rand::prelude::*;\nuse rand::rng;\n\nuse crate::cluster::{Cl"
  },
  {
    "path": "cdrs-tokio/src/load_balancing/request.rs",
    "chars": 372,
    "preview": "use cassandra_protocol::consistency::Consistency;\nuse derive_more::Constructor;\n\nuse crate::cluster::Murmur3Token;\n\n/// "
  },
  {
    "path": "cdrs-tokio/src/load_balancing/round_robin.rs",
    "chars": 1499,
    "preview": "use derivative::Derivative;\nuse std::marker::PhantomData;\nuse std::sync::atomic::{AtomicUsize, Ordering};\n\nuse crate::cl"
  },
  {
    "path": "cdrs-tokio/src/load_balancing/topology_aware.rs",
    "chars": 27171,
    "preview": "use crate::cluster::topology::{KeyspaceMetadata, Node, NodeDistance, ReplicationStrategy};\nuse crate::cluster::Murmur3To"
  },
  {
    "path": "cdrs-tokio/src/load_balancing.rs",
    "chars": 1366,
    "preview": "mod initializing_wrapper;\npub mod node_distance_evaluator;\nmod random;\nmod request;\nmod round_robin;\nmod topology_aware;"
  },
  {
    "path": "cdrs-tokio/src/macros.rs",
    "chars": 846,
    "preview": "#[macro_export]\n\n/// Transforms arguments to values consumed by queries.\nmacro_rules! query_values {\n    ($($value:expr)"
  },
  {
    "path": "cdrs-tokio/src/retry/reconnection_policy.rs",
    "chars": 6906,
    "preview": "use derive_more::Constructor;\n#[cfg(test)]\nuse mockall::automock;\nuse rand::{rng, RngExt};\nuse std::time::Duration;\n\ncon"
  },
  {
    "path": "cdrs-tokio/src/retry/retry_policy.rs",
    "chars": 5331,
    "preview": "use derive_more::Display;\n\nuse cassandra_protocol::error::Error;\nuse cassandra_protocol::frame::message_error::{\n    Err"
  },
  {
    "path": "cdrs-tokio/src/retry.rs",
    "chars": 101,
    "preview": "mod reconnection_policy;\nmod retry_policy;\n\npub use reconnection_policy::*;\npub use retry_policy::*;\n"
  },
  {
    "path": "cdrs-tokio/src/speculative_execution.rs",
    "chars": 2023,
    "preview": "//! Pre-emptively query another node if the current one takes too long to respond.\n//!\n//! Sometimes a Cassandra node mi"
  },
  {
    "path": "cdrs-tokio/src/statement/statement_params.rs",
    "chars": 1955,
    "preview": "use cassandra_protocol::query::QueryParams;\nuse cassandra_protocol::types::value::Value;\nuse derivative::Derivative;\nuse"
  },
  {
    "path": "cdrs-tokio/src/statement/statement_params_builder.rs",
    "chars": 5836,
    "preview": "use cassandra_protocol::consistency::Consistency;\nuse cassandra_protocol::query::{QueryFlags, QueryParams, QueryValues};"
  },
  {
    "path": "cdrs-tokio/src/statement.rs",
    "chars": 119,
    "preview": "mod statement_params;\nmod statement_params_builder;\n\npub use statement_params::*;\npub use statement_params_builder::*;\n"
  },
  {
    "path": "cdrs-tokio/src/transport.rs",
    "chars": 30251,
    "preview": "//!This module contains a declaration of `CdrsTransport` trait which should be implemented\n//!for particular transport t"
  },
  {
    "path": "cdrs-tokio/tests/collection_types.rs",
    "chars": 20569,
    "preview": "mod common;\n\n#[cfg(feature = \"e2e-tests\")]\nuse cassandra_protocol::frame::Version;\n#[cfg(feature = \"e2e-tests\")]\nuse cdr"
  },
  {
    "path": "cdrs-tokio/tests/common.rs",
    "chars": 3040,
    "preview": "#[cfg(feature = \"e2e-tests\")]\nuse std::sync::Arc;\n\n#[cfg(feature = \"e2e-tests\")]\nuse cassandra_protocol::frame::Version;"
  },
  {
    "path": "cdrs-tokio/tests/compression.rs",
    "chars": 2827,
    "preview": "mod common;\n\n#[cfg(feature = \"e2e-tests\")]\nuse cassandra_protocol::compression::Compression;\n#[cfg(feature = \"e2e-tests\""
  },
  {
    "path": "cdrs-tokio/tests/derive_traits.rs",
    "chars": 14330,
    "preview": "#![cfg(feature = \"derive\")]\nmod common;\n\n#[cfg(feature = \"e2e-tests\")]\nuse cassandra_protocol::frame::Version;\n#[cfg(fea"
  },
  {
    "path": "cdrs-tokio/tests/keyspace.rs",
    "chars": 8147,
    "preview": "#[cfg(feature = \"e2e-tests\")]\nuse std::collections::HashMap;\n#[cfg(feature = \"e2e-tests\")]\nuse std::sync::Arc;\n\n#[cfg(fe"
  },
  {
    "path": "cdrs-tokio/tests/multi_node_speculative_execution.rs",
    "chars": 3168,
    "preview": "mod common;\n\n#[cfg(feature = \"e2e-tests\")]\nuse cdrs_tokio::cluster::session::{SessionBuilder, TcpSessionBuilder};\n#[cfg("
  },
  {
    "path": "cdrs-tokio/tests/multithread.rs",
    "chars": 2039,
    "preview": "#[cfg(feature = \"e2e-tests\")]\nuse cdrs_tokio::authenticators::NoneAuthenticatorProvider;\n#[cfg(feature = \"e2e-tests\")]\nu"
  },
  {
    "path": "cdrs-tokio/tests/native_types.rs",
    "chars": 18176,
    "preview": "mod common;\n\n#[cfg(feature = \"e2e-tests\")]\nuse cassandra_protocol::frame::Version;\n#[cfg(feature = \"e2e-tests\")]\nuse cdr"
  },
  {
    "path": "cdrs-tokio/tests/paged_query.rs",
    "chars": 2472,
    "preview": "#[cfg(feature = \"e2e-tests\")]\nuse cdrs_tokio::authenticators::NoneAuthenticatorProvider;\n#[cfg(feature = \"e2e-tests\")]\nu"
  },
  {
    "path": "cdrs-tokio/tests/query_values.rs",
    "chars": 2233,
    "preview": "mod common;\n\n#[cfg(feature = \"e2e-tests\")]\nuse cassandra_protocol::frame::Version;\n#[cfg(feature = \"e2e-tests\")]\nuse cdr"
  },
  {
    "path": "cdrs-tokio/tests/single_node_speculative_execution.rs",
    "chars": 3087,
    "preview": "mod common;\n\n#[cfg(feature = \"e2e-tests\")]\nuse cdrs_tokio::cluster::session::{SessionBuilder, TcpSessionBuilder};\n#[cfg("
  },
  {
    "path": "cdrs-tokio/tests/topology_aware.rs",
    "chars": 3227,
    "preview": "mod common;\n\n#[cfg(feature = \"e2e-tests\")]\nuse cdrs_tokio::authenticators::NoneAuthenticatorProvider;\n#[cfg(feature = \"e"
  },
  {
    "path": "cdrs-tokio/tests/tuple_types.rs",
    "chars": 13184,
    "preview": "mod common;\n\n#[cfg(feature = \"e2e-tests\")]\nuse common::*;\n\n#[cfg(feature = \"e2e-tests\")]\nuse cassandra_protocol::frame::"
  },
  {
    "path": "cdrs-tokio/tests/user_defined_types.rs",
    "chars": 16841,
    "preview": "mod common;\n\n#[cfg(feature = \"e2e-tests\")]\nuse cassandra_protocol::frame::Version;\n#[cfg(feature = \"e2e-tests\")]\nuse cdr"
  },
  {
    "path": "cdrs-tokio-helpers-derive/Cargo.toml",
    "chars": 423,
    "preview": "[package]\nname = \"cdrs-tokio-helpers-derive\"\nversion = \"5.0.3\"\nauthors = [\"Alex Pikalov <alex.pikalov.khar@gmail.com>\", "
  },
  {
    "path": "cdrs-tokio-helpers-derive/README.md",
    "chars": 672,
    "preview": "# cdrs-tokio-helpers-derive\n\nProcedural macros that derive helper traits for CDRS Cassandra to Rust types conversion bac"
  },
  {
    "path": "cdrs-tokio-helpers-derive/src/common.rs",
    "chars": 10630,
    "preview": "use itertools::Itertools;\nuse proc_macro2::{Literal, TokenStream};\nuse quote::*;\nuse syn::spanned::Spanned;\nuse syn::{\n "
  },
  {
    "path": "cdrs-tokio-helpers-derive/src/db_mirror.rs",
    "chars": 1581,
    "preview": "use itertools::Itertools;\nuse proc_macro2::TokenStream;\nuse quote::*;\nuse syn::spanned::Spanned;\nuse syn::{DeriveInput, "
  },
  {
    "path": "cdrs-tokio-helpers-derive/src/into_cdrs_value.rs",
    "chars": 2561,
    "preview": "use itertools::Itertools;\nuse proc_macro2::TokenStream;\nuse quote::*;\nuse syn::spanned::Spanned;\nuse syn::{Data, DataStr"
  },
  {
    "path": "cdrs-tokio-helpers-derive/src/lib.rs",
    "chars": 1676,
    "preview": "//! This trait provides functionality for derivation  `IntoCDRSBytes` trait implementation\n//! for underlying\nuse proc_m"
  },
  {
    "path": "cdrs-tokio-helpers-derive/src/try_from_row.rs",
    "chars": 787,
    "preview": "use proc_macro2::TokenStream;\nuse quote::*;\nuse syn::{DeriveInput, Result};\n\nuse crate::common::get_struct_fields;\n\npub "
  },
  {
    "path": "cdrs-tokio-helpers-derive/src/try_from_udt.rs",
    "chars": 786,
    "preview": "use proc_macro2::TokenStream;\nuse quote::*;\nuse syn::{DeriveInput, Result};\n\nuse crate::common::get_struct_fields;\n\npub "
  },
  {
    "path": "changelog.md",
    "chars": 11144,
    "preview": "## 9.0.1\n\n### Fixed\n\n* Fixe querying peers in `yugabytedb` (by Andries Hiemstra).\n\n## 9.0.0\n\n### Fixed\n\n* Fixed not re-p"
  },
  {
    "path": "clippy.toml",
    "chars": 135,
    "preview": "# the main Error enum is a bit above the default limit, but contains very useful data for pattern matching\nlarge-error-t"
  },
  {
    "path": "documentation/README.md",
    "chars": 347,
    "preview": "# Definitive guide\n\n- [Cluster configuration](./cluster-configuration.md).\n- [CDRS session](./cdrs-session.md):\n- [Query"
  },
  {
    "path": "documentation/batching-multiple-queries.md",
    "chars": 446,
    "preview": "### Batch queries\n\nCDRS `Session` supports batching few queries in a single request to Apache Cassandra:\n\n```rust\n// bat"
  },
  {
    "path": "documentation/cdrs-session.md",
    "chars": 1807,
    "preview": "# CDRS Session\n\n`Session` is a structure that holds as set pools of connections authorised by a Cluster. As well, it pro"
  },
  {
    "path": "documentation/cluster-configuration.md",
    "chars": 2091,
    "preview": "### Cluster configuration\n\nApache Cassandra is designed to be a scalable and higly available database. So most often dev"
  },
  {
    "path": "documentation/deserialization.md",
    "chars": 1409,
    "preview": "### Mapping results into Rust structures\n\nIn order to query information from Cassandra DB and transform results to Rust "
  },
  {
    "path": "documentation/preparing-and-executing-queries.md",
    "chars": 988,
    "preview": "### Preparing queries\n\nDuring preparing a query a server parses the query, saves parsing result into cache and returns t"
  },
  {
    "path": "documentation/query-values.md",
    "chars": 2741,
    "preview": "# Query `Value`\n\nQuery `Value`-s can be used along with query string templates. Query string templates is a special sort"
  },
  {
    "path": "documentation/type-mapping.md",
    "chars": 770,
    "preview": "### Type relations between Rust (in CDRS approach) and Apache Cassandra\n\n#### primitive types (`T`)\n\n| Cassandra | Rust "
  },
  {
    "path": "rustfmt.toml",
    "chars": 49,
    "preview": "use_field_init_shorthand = true\nedition = \"2018\"\n"
  }
]

About this extraction

This page contains the full source code of the krojew/cdrs-tokio GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 155 files (988.6 KB), approximately 244.5k tokens, and a symbol index with 1581 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!