Skip to content

Commit

Permalink
[events, messages] Move name_variant -> strum_macros
Browse files Browse the repository at this point in the history
  • Loading branch information
huitseeker committed Nov 23, 2022
1 parent 8c4b473 commit cb1bfef
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 214 deletions.
11 changes: 0 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ members = [
"crates/mysten-network",
"crates/mysten-util-mem",
"crates/mysten-util-mem-derive",
"crates/name-variant",
"crates/prometheus-closure-metric",
"crates/rccheck",
"crates/sui",
Expand Down
18 changes: 0 additions & 18 deletions crates/name-variant/Cargo.toml

This file was deleted.

35 changes: 0 additions & 35 deletions crates/name-variant/README.md

This file was deleted.

109 changes: 0 additions & 109 deletions crates/name-variant/src/lib.rs

This file was deleted.

33 changes: 0 additions & 33 deletions crates/name-variant/tests/test.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/sui-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ fastcrypto = { workspace = true, features = ["copy_key"] }

sui-cost-tables = { path = "../sui-cost-tables"}
typed-store.workspace = true
name-variant = { path = "../../crates/name-variant" }

workspace-hack.workspace = true
proptest = "1.0.0"
Expand Down
6 changes: 3 additions & 3 deletions crates/sui-types/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ use move_core_types::identifier::IdentStr;
use move_core_types::identifier::Identifier;
use move_core_types::language_storage::StructTag;
use move_core_types::value::MoveStruct;
use name_variant::NamedVariant;

use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use serde_with::serde_as;
use serde_with::Bytes;
use strum::IntoStaticStr;
use strum::VariantNames;
use strum_macros::{EnumDiscriminants, EnumVariantNames};
use tracing::error;
Expand Down Expand Up @@ -102,7 +102,7 @@ impl EventEnvelope {
}

pub fn event_type(&self) -> &'static str {
self.event.variant_name()
(&self.event).into()
}
}

Expand Down Expand Up @@ -135,12 +135,12 @@ pub enum TransferType {
Debug,
Clone,
PartialEq,
NamedVariant,
Deserialize,
Serialize,
Hash,
EnumDiscriminants,
EnumVariantNames,
IntoStaticStr,
)]
#[strum_discriminants(derive(strum_macros::EnumString))]
#[strum_discriminants(name(EventType), derive(Serialize, Deserialize, JsonSchema))]
Expand Down
6 changes: 3 additions & 3 deletions crates/sui-types/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use move_core_types::{
account_address::AccountAddress, identifier::Identifier, language_storage::TypeTag,
value::MoveStructLayout,
};
use name_variant::NamedVariant;
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
use serde_with::Bytes;
Expand All @@ -39,6 +38,7 @@ use std::{
collections::{BTreeMap, BTreeSet, HashSet},
hash::{Hash, Hasher},
};
use strum::IntoStaticStr;
use tracing::debug;

#[cfg(test)]
Expand Down Expand Up @@ -437,7 +437,7 @@ impl Display for SingleTransactionKind {

// TODO: Make SingleTransactionKind a Box
#[allow(clippy::large_enum_variant)]
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, NamedVariant)]
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, IntoStaticStr)]
pub enum TransactionKind {
/// A single transaction.
Single(SingleTransactionKind),
Expand Down Expand Up @@ -723,7 +723,7 @@ impl TransactionData {

/// Returns the transaction kind as a &str (variant name, no fields)
pub fn kind_as_str(&self) -> &'static str {
self.kind.variant_name()
(&self.kind).into()
}

pub fn gas(&self) -> ObjectRef {
Expand Down

0 comments on commit cb1bfef

Please sign in to comment.