Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unneeded deps #185

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions cassandra-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ e2e-tests = []

[dependencies]
arc-swap.workspace = true
arrayref = "0.3.7"
bitflags = "2.5.0"
chrono = { version = "0.4.31", default_features = false, features = ["std"] }
crc32fast = "1.4.0"
Expand All @@ -25,10 +24,10 @@ derive_more.workspace = true
float_eq = "1.0.1"
integer-encoding = "4.0.0"
itertools.workspace = true
num = "0.4.1"
num-bigint = "0.4.1"
lz4_flex = "0.11.1"
snap = "1.1.0"
thiserror.workspace = true
time = { version = "0.3.29", features = ["std", "macros"] }
time = { version = "0.3.29", features = ["macros"] }
uuid.workspace = true
bytes.workspace = true
2 changes: 1 addition & 1 deletion cassandra-protocol/src/frame/traits.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::error;
use crate::frame::Version;
use crate::query;
use num::BigInt;
use num_bigint::BigInt;
use std::io::{Cursor, Write};

/// Trait that should be implemented by all types that wish to be serialized to a buffer.
Expand Down
2 changes: 1 addition & 1 deletion cassandra-protocol/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ pub fn cursor_next_value_ref<'a>(
mod tests {
use super::*;
use crate::frame::traits::FromCursor;
use num::BigInt;
use num_bigint::BigInt;
use std::io::Cursor;

fn from_i_bytes(bytes: &[u8]) -> i64 {
Expand Down
2 changes: 1 addition & 1 deletion cassandra-protocol/src/types/cassandra_type.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::BigInt;
use num_bigint::BigInt;
use std::collections::HashMap;
use std::net::IpAddr;

Expand Down
24 changes: 9 additions & 15 deletions cassandra-protocol/src/types/data_serialization_types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use arrayref::array_ref;
use integer_encoding::VarInt;
use num::BigInt;
use num_bigint::BigInt;
use std::convert::TryInto;
use std::io;
use std::net;
use std::string::FromUtf8Error;
Expand All @@ -12,7 +12,7 @@ use crate::error;
use crate::frame::{FromCursor, Version};
use crate::types::{
try_f32_from_bytes, try_f64_from_bytes, try_i16_from_bytes, try_i32_from_bytes,
try_i64_from_bytes, u16_from_bytes, CBytes, CInt, INT_LEN,
try_i64_from_bytes, CBytes, CInt, INT_LEN,
};

// https://github.com/apache/cassandra/blob/trunk/doc/native_protocol_v4.spec#L813
Expand Down Expand Up @@ -105,20 +105,14 @@ pub fn decode_float(bytes: &[u8]) -> Result<f32, io::Error> {
pub fn decode_inet(bytes: &[u8]) -> Result<net::IpAddr, io::Error> {
match bytes.len() {
// v4
4 => Ok(net::IpAddr::V4(net::Ipv4Addr::new(
bytes[0], bytes[1], bytes[2], bytes[3],
))),
4 => {
let array: [u8; 4] = bytes[0..4].try_into().unwrap();
Ok(net::IpAddr::V4(net::Ipv4Addr::from(array)))
krojew marked this conversation as resolved.
Show resolved Hide resolved
}
// v6
16 => {
let a = u16_from_bytes(*array_ref!(bytes, 0, 2));
let b = u16_from_bytes(*array_ref!(bytes, 2, 2));
let c = u16_from_bytes(*array_ref!(bytes, 4, 2));
let d = u16_from_bytes(*array_ref!(bytes, 6, 2));
let e = u16_from_bytes(*array_ref!(bytes, 8, 2));
let f = u16_from_bytes(*array_ref!(bytes, 10, 2));
let g = u16_from_bytes(*array_ref!(bytes, 12, 2));
let h = u16_from_bytes(*array_ref!(bytes, 14, 2));
Ok(net::IpAddr::V6(net::Ipv6Addr::new(a, b, c, d, e, f, g, h)))
let array: [u8; 16] = bytes[0..16].try_into().unwrap();
Ok(net::IpAddr::V6(net::Ipv6Addr::from(array)))
krojew marked this conversation as resolved.
Show resolved Hide resolved
}
_ => Err(io::Error::new(
io::ErrorKind::Other,
Expand Down
2 changes: 1 addition & 1 deletion cassandra-protocol/src/types/decimal.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use derive_more::Constructor;
use float_eq::*;
use num::BigInt;
use num_bigint::BigInt;
use std::io::Cursor;

use crate::frame::{Serialize, Version};
Expand Down
2 changes: 1 addition & 1 deletion cassandra-protocol/src/types/list.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use derive_more::Constructor;
use num::BigInt;
use num_bigint::BigInt;
use std::net::IpAddr;
use uuid::Uuid;

Expand Down
2 changes: 1 addition & 1 deletion cassandra-protocol/src/types/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::types::list::List;
use crate::types::tuple::Tuple;
use crate::types::udt::Udt;
use crate::types::{AsRust, AsRustType, CBytes};
use num::BigInt;
use num_bigint::BigInt;

#[derive(Debug)]
pub struct Map {
Expand Down
2 changes: 1 addition & 1 deletion cassandra-protocol/src/types/rows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::types::map::Map;
use crate::types::tuple::Tuple;
use crate::types::udt::Udt;
use crate::types::{ByIndex, ByName, CBytes, IntoRustByIndex, IntoRustByName};
use num::BigInt;
use num_bigint::BigInt;

#[derive(Clone, Debug)]
pub struct Row {
Expand Down
2 changes: 1 addition & 1 deletion cassandra-protocol/src/types/tuple.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use chrono::prelude::*;
use num::BigInt;
use num_bigint::BigInt;
use std::hash::{Hash, Hasher};
use std::net::IpAddr;
use time::PrimitiveDateTime;
Expand Down
2 changes: 1 addition & 1 deletion cassandra-protocol/src/types/udt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::types::list::List;
use crate::types::map::Map;
use crate::types::tuple::Tuple;
use crate::types::{ByName, CBytes, IntoRustByName};
use num::BigInt;
use num_bigint::BigInt;

#[derive(Clone, Debug)]
pub struct Udt {
Expand Down
2 changes: 1 addition & 1 deletion cassandra-protocol/src/types/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::net::IpAddr;
use std::num::{NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8};

use chrono::prelude::*;
use num::BigInt;
use num_bigint::BigInt;
use time::PrimitiveDateTime;
use uuid::Uuid;

Expand Down
Loading