From 6ed6066b1fc94718ccfa72ae7591e60de0344114 Mon Sep 17 00:00:00 2001 From: Natty Date: Wed, 25 Oct 2023 19:45:59 +0200 Subject: [PATCH] MMM: Reexport in the SDK --- Cargo.lock | 29 ++++++++++++++++------------- magnetar_mmm_parser/Cargo.toml | 5 +++-- magnetar_mmm_parser/src/lib.rs | 5 +++-- magnetar_sdk/Cargo.toml | 3 ++- magnetar_sdk/src/lib.rs | 1 + 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 35e50cd..1112838 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -603,6 +603,7 @@ dependencies = [ "cfg-if", "itoa", "ryu", + "serde", "static_assertions", ] @@ -1507,6 +1508,20 @@ dependencies = [ "serde_json", ] +[[package]] +name = "magnetar_mmm_parser" +version = "0.2.1-alpha" +dependencies = [ + "compact_str", + "either", + "emojis", + "nom", + "nom_locate", + "serde", + "tracing", + "unicode-segmentation", +] + [[package]] name = "magnetar_nodeinfo" version = "0.2.1-alpha" @@ -1521,6 +1536,7 @@ version = "0.2.1-alpha" dependencies = [ "chrono", "http", + "magnetar_mmm_parser", "magnetar_sdk_macros", "serde", "serde_json", @@ -1640,19 +1656,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "mmm_parser" -version = "0.2.1-alpha" -dependencies = [ - "compact_str", - "either", - "emojis", - "nom", - "nom_locate", - "tracing", - "unicode-segmentation", -] - [[package]] name = "nom" version = "7.1.3" diff --git a/magnetar_mmm_parser/Cargo.toml b/magnetar_mmm_parser/Cargo.toml index d7b9b2d..bee8c3a 100644 --- a/magnetar_mmm_parser/Cargo.toml +++ b/magnetar_mmm_parser/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "mmm_parser" +name = "magnetar_mmm_parser" version.workspace = true edition.workspace = true license = "MIT OR Apache-2.0" @@ -9,6 +9,7 @@ either = { workspace = true } emojis = { workspace = true } nom = { workspace = true } nom_locate = { workspace = true } -compact_str = { workspace = true } +compact_str = { workspace = true, features = ["serde"] } +serde = { workspace = true, features = ["derive"] } tracing = { workspace = true } unicode-segmentation = { workspace = true } diff --git a/magnetar_mmm_parser/src/lib.rs b/magnetar_mmm_parser/src/lib.rs index 26661e6..811b157 100644 --- a/magnetar_mmm_parser/src/lib.rs +++ b/magnetar_mmm_parser/src/lib.rs @@ -12,13 +12,14 @@ use nom::multi::{many0, many0_count, many1, many1_count, many_till, separated_li use nom::sequence::tuple; use nom::{IResult, Offset, Parser, Slice}; use nom_locate::LocatedSpan; +use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::convert::{identity, Infallible}; use std::marker::PhantomData; use tracing::trace; use unicode_segmentation::UnicodeSegmentation; -#[derive(Copy, Clone, Debug, Eq, PartialEq)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Deserialize, Serialize)] pub enum MentionType { Community, User, @@ -33,7 +34,7 @@ impl MentionType { } } -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)] pub enum Token { PlainText(CompactString), Sequence(Vec), diff --git a/magnetar_sdk/Cargo.toml b/magnetar_sdk/Cargo.toml index 0bf402c..03a89d4 100644 --- a/magnetar_sdk/Cargo.toml +++ b/magnetar_sdk/Cargo.toml @@ -5,6 +5,7 @@ edition.workspace = true license = "MIT OR Apache-2.0" [dependencies] +magnetar_mmm_parser = { path = "../magnetar_mmm_parser" } magnetar_sdk_macros = { path = "./macros" } chrono = { workspace = true, features = ["serde"] } @@ -15,4 +16,4 @@ serde_json = { workspace = true } ts-rs = { workspace = true, features = ["chrono", "chrono-impl"] } -unicode-segmentation = { workspace = true } \ No newline at end of file +unicode-segmentation = { workspace = true } diff --git a/magnetar_sdk/src/lib.rs b/magnetar_sdk/src/lib.rs index a12afe6..79189ff 100644 --- a/magnetar_sdk/src/lib.rs +++ b/magnetar_sdk/src/lib.rs @@ -1,6 +1,7 @@ use serde::{Deserialize, Serialize}; use ts_rs::TS; +pub use magnetar_mmm_parser as mmm; pub mod endpoints; pub mod types; pub mod util_types;