Skip to content

Commit d08f624

Browse files
committed
topology: removed usages of strum from ColumnKind
Replaced strum crate usage for ColumnKind with our own implemnetation.
1 parent 242bc2a commit d08f624

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

scylla/src/transport/topology.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use std::num::NonZeroUsize;
2626
use std::str::FromStr;
2727
use std::sync::Arc;
2828
use std::time::{Duration, Instant};
29-
use strum_macros::EnumString;
3029
use tokio::sync::{broadcast, mpsc};
3130
use tracing::{debug, error, trace, warn};
3231
use uuid::Uuid;
@@ -348,15 +347,32 @@ pub enum CollectionType {
348347
Set(Box<CqlType>),
349348
}
350349

351-
#[derive(Clone, Debug, PartialEq, Eq, EnumString)]
352-
#[strum(serialize_all = "snake_case")]
350+
#[derive(Clone, Debug, PartialEq, Eq)]
353351
pub enum ColumnKind {
354352
Regular,
355353
Static,
356354
Clustering,
357355
PartitionKey,
358356
}
359357

358+
/// [ColumnKind] parse error
359+
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
360+
pub struct ColumnKindFromStrError;
361+
362+
impl std::str::FromStr for ColumnKind {
363+
type Err = ColumnKindFromStrError;
364+
365+
fn from_str(s: &str) -> Result<Self, Self::Err> {
366+
match s {
367+
"regular" => Ok(Self::Regular),
368+
"static" => Ok(Self::Static),
369+
"clustering" => Ok(Self::Clustering),
370+
"partition_key" => Ok(Self::PartitionKey),
371+
_ => Err(ColumnKindFromStrError),
372+
}
373+
}
374+
}
375+
360376
#[derive(Clone, Debug, PartialEq, Eq)]
361377
#[allow(clippy::enum_variant_names)]
362378
pub enum Strategy {

0 commit comments

Comments
 (0)