From 6b6762a81aae962ea11bca7d53b2b2c58c57901a Mon Sep 17 00:00:00 2001 From: kawaemon Date: Sun, 1 Dec 2024 02:51:39 +0900 Subject: [PATCH 1/5] chore: remove just file --- Justfile | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 Justfile diff --git a/Justfile b/Justfile deleted file mode 100644 index e0247ff..0000000 --- a/Justfile +++ /dev/null @@ -1,14 +0,0 @@ -# vim: ft=make - -set dotenv-load := false - -setup: - echo "just commit" >> ./.git/hooks/pre-commit - chmod +x ./.git/hooks/pre-commit - -commit: - cargo fmt - cargo clippy --no-default-features --features dev - cargo clippy --no-default-features --features prod - cargo test --no-default-features --features dev - cargo test --no-default-features --features prod From 64ae8ebbbfef57d25d2af04deba77da4515bdd3f Mon Sep 17 00:00:00 2001 From: kawaemon Date: Sun, 1 Dec 2024 02:51:53 +0900 Subject: [PATCH 2/5] chore: move constants --- src/bot/meigen/mod.rs | 5 ++--- src/bot/mod.rs | 2 -- src/bot/uo/mod.rs | 3 ++- src/client/discord.rs | 3 +-- src/lib.rs | 3 +++ 5 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 src/lib.rs diff --git a/src/bot/meigen/mod.rs b/src/bot/meigen/mod.rs index bd402db..47f893d 100644 --- a/src/bot/meigen/mod.rs +++ b/src/bot/meigen/mod.rs @@ -1,10 +1,9 @@ use { - crate::bot::{ - parse_command, ui, BotService, Context, IsUpdated, Message, KAWAEMON_DISCORD_USER_ID, - }, + crate::bot::{parse_command, ui, BotService, Context, IsUpdated, Message}, anyhow::{Context as _, Result}, async_trait::async_trait, model::{Meigen, MeigenId}, + rusty_ponyo::KAWAEMON_DISCORD_USER_ID, }; pub mod model; diff --git a/src/bot/mod.rs b/src/bot/mod.rs index 34f512c..5f8f546 100644 --- a/src/bot/mod.rs +++ b/src/bot/mod.rs @@ -4,8 +4,6 @@ use { std::{future::Future, pin::Pin}, }; -const KAWAEMON_DISCORD_USER_ID: u64 = 391857452360007680; - /// 変更が生じた場合 true pub type IsUpdated = bool; diff --git a/src/bot/uo/mod.rs b/src/bot/uo/mod.rs index ca7f2e8..210c4a1 100644 --- a/src/bot/uo/mod.rs +++ b/src/bot/uo/mod.rs @@ -1,6 +1,7 @@ -use crate::bot::{parse_command, ui, BotService, Context, Message, KAWAEMON_DISCORD_USER_ID}; +use crate::bot::{parse_command, ui, BotService, Context, Message}; use anyhow::{Context as _, Result}; use async_trait::async_trait; +use rusty_ponyo::KAWAEMON_DISCORD_USER_ID; use tokio::sync::Mutex; const NAME: &str = "rusty_ponyo::bot::uo"; diff --git a/src/client/discord.rs b/src/client/discord.rs index 6261275..09b5534 100644 --- a/src/client/discord.rs +++ b/src/client/discord.rs @@ -2,6 +2,7 @@ use { crate::bot::{Attachment, BotService, Context, Message, SendMessage, User}, anyhow::{Context as _, Result}, async_trait::async_trait, + rusty_ponyo::{APPROVERS_DEFAULT_CHANNEL_ID, APPROVERS_GUILD_ID}, serenity::{ builder::{CreateAttachment, CreateMessage}, model::{ @@ -81,8 +82,6 @@ impl DiscordClient { } // TODO: should be configurable -const APPROVERS_GUILD_ID: u64 = 683939861539192860; -const APPROVERS_DEFAULT_CHANNEL_ID: u64 = 690909527461199922; struct EvHandlerInner { services: Vec>, diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..58bd9f9 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,3 @@ +pub const KAWAEMON_DISCORD_USER_ID: u64 = 391857452360007680; +pub const APPROVERS_GUILD_ID: u64 = 683939861539192860; +pub const APPROVERS_DEFAULT_CHANNEL_ID: u64 = 690909527461199922; From d64b1657d035e20a08bc94c4dcafc1224446413b Mon Sep 17 00:00:00 2001 From: kawaemon Date: Sun, 1 Dec 2024 05:21:44 +0900 Subject: [PATCH 3/5] fun: :sparkles: STATICALLY DISPATCHED CLIENTS :sparkles: --- Cargo.lock | 1 - Cargo.toml | 1 - src/bot/alias/command.rs | 4 +- src/bot/alias/mod.rs | 34 +-- src/bot/auth/mod.rs | 34 +-- src/bot/genkai_point/formula/mod.rs | 2 +- src/bot/genkai_point/mod.rs | 91 ++++---- src/bot/genkai_point/plot/mod.rs | 2 +- src/bot/gh/mod.rs | 69 ++++-- src/bot/meigen/mod.rs | 34 +-- src/bot/mod.rs | 112 +++++---- src/bot/uo/mod.rs | 8 +- src/bot/vc_diff/mod.rs | 14 +- src/client/console.rs | 133 ++++++----- src/client/discord.rs | 338 ++++++++++++++++++---------- src/client/mod.rs | 37 +++ src/db/mem.rs | 5 - src/db/mongodb/mod.rs | 5 - src/main.rs | 11 +- 19 files changed, 574 insertions(+), 361 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 86e6731..8358938 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3580,7 +3580,6 @@ name = "rusty-ponyo" version = "2024.9.25-2" dependencies = [ "anyhow", - "async-trait", "bson", "bzip2-sys", "charming", diff --git a/Cargo.toml b/Cargo.toml index 993702f..31bdb14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,6 @@ default = ["prod"] [dependencies] anyhow = "1" -async-trait = "0.1" chrono = { version = "0.4", features = ["serde"] } chrono-tz = "0.10" clap = { version = "4", features = ["derive"] } diff --git a/src/bot/alias/command.rs b/src/bot/alias/command.rs index 31aaa20..109c1b3 100644 --- a/src/bot/alias/command.rs +++ b/src/bot/alias/command.rs @@ -53,10 +53,10 @@ impl MessageAliasBot { pub(super) async fn make( &self, - ctx: &dyn Context, + ctx: &impl Context, key: &str, msg: Option<&str>, - attachments: &[&dyn Attachment], + attachments: &[impl Attachment], force: bool, ) -> Result<()> { let key = key.trim(); diff --git a/src/bot/alias/mod.rs b/src/bot/alias/mod.rs index 86610d6..9461c2e 100644 --- a/src/bot/alias/mod.rs +++ b/src/bot/alias/mod.rs @@ -4,10 +4,10 @@ pub(crate) mod model; use { crate::bot::{ alias::model::MessageAlias, parse_command, ui, BotService, Context, IsUpdated, Message, - SendAttachment, SendMessage, + Runtime, SendAttachment, SendMessage, }, anyhow::Result, - async_trait::async_trait, + std::future::Future, }; const NAME: &str = "rusty_ponyo::bot::alias"; @@ -50,27 +50,29 @@ enum Command { }, } -#[async_trait] pub(crate) trait MessageAliasDatabase: Send + Sync { - async fn save(&self, alias: MessageAlias) -> Result<()>; - async fn get(&self, key: &str) -> Result>; - async fn get_and_increment_usage_count(&self, key: &str) -> Result>; - async fn delete(&self, key: &str) -> Result; - async fn len(&self) -> Result; - async fn usage_count_top_n(&self, n: usize) -> Result>; + fn save(&self, alias: MessageAlias) -> impl Future> + Send; + fn get(&self, key: &str) -> impl Future>> + Send; + fn get_and_increment_usage_count( + &self, + key: &str, + ) -> impl Future>> + Send; + fn delete(&self, key: &str) -> impl Future> + Send; + fn len(&self) -> impl Future> + Send; + fn usage_count_top_n(&self, n: usize) + -> impl Future>> + Send; } pub(crate) struct MessageAliasBot { db: D, } -#[async_trait] -impl BotService for MessageAliasBot { +impl BotService for MessageAliasBot { fn name(&self) -> &'static str { NAME } - async fn on_message(&self, msg: &dyn Message, ctx: &dyn Context) -> Result<()> { + async fn on_message(&self, msg: &R::Message, ctx: &R::Context) -> Result<()> { if msg.content().starts_with(PREFIX) { if let Some(msg) = self.on_command(msg, ctx).await? { ctx.send_message(SendMessage { @@ -94,7 +96,11 @@ impl MessageAliasBot { Self { db } } - async fn on_command(&self, message: &dyn Message, ctx: &dyn Context) -> Result> { + async fn on_command( + &self, + message: &impl Message, + ctx: &impl Context, + ) -> Result> { let Some(parsed) = parse_command::(message.content(), ctx).await? else { return Ok(None); }; @@ -117,7 +123,7 @@ impl MessageAliasBot { } } - async fn send_alias(&self, ctx: &dyn Context, alias: &MessageAlias) -> Result<()> { + async fn send_alias(&self, ctx: &impl Context, alias: &MessageAlias) -> Result<()> { ctx.send_message(SendMessage { content: &alias.message, attachments: &alias diff --git a/src/bot/auth/mod.rs b/src/bot/auth/mod.rs index f5786fb..ecfb3d6 100644 --- a/src/bot/auth/mod.rs +++ b/src/bot/auth/mod.rs @@ -1,7 +1,6 @@ use { - crate::bot::{parse_command, ui, BotService, Context, Message}, + crate::bot::{parse_command, ui, BotService, Context, Message, Runtime, User}, anyhow::{Context as _, Result}, - async_trait::async_trait, rand::{prelude::StdRng, Rng, SeedableRng}, sequoia_openpgp::{ cert::CertParser, @@ -11,7 +10,7 @@ use { Cert, }, sha2::Digest, - std::{io::Write, time::Duration}, + std::{future::Future, io::Write, time::Duration}, url::{Host, Origin, Url}, }; @@ -50,14 +49,18 @@ enum SetCommand { }, } -#[async_trait] pub(crate) trait GenkaiAuthDatabase: Send + Sync { - async fn register_pgp_key(&self, user_id: u64, cert: &str) -> Result<()>; - async fn get_pgp_key(&self, user_id: u64) -> Result>; - - async fn register_token(&self, user_id: u64, hashed_token: &str) -> Result<()>; - async fn revoke_token(&self, user_id: u64) -> Result<()>; - async fn get_token(&self, user_id: u64) -> Result>; + fn register_pgp_key(&self, user_id: u64, cert: &str) + -> impl Future> + Send; + fn get_pgp_key(&self, user_id: u64) -> impl Future>> + Send; + + fn register_token( + &self, + user_id: u64, + hashed_token: &str, + ) -> impl Future> + Send; + fn revoke_token(&self, user_id: u64) -> impl Future> + Send; + fn get_token(&self, user_id: u64) -> impl Future>> + Send; } pub(crate) struct GenkaiAuthBot { @@ -65,13 +68,12 @@ pub(crate) struct GenkaiAuthBot { pgp_pubkey_source_domain_whitelist: Vec, } -#[async_trait] -impl BotService for GenkaiAuthBot { +impl BotService for GenkaiAuthBot { fn name(&self) -> &'static str { NAME } - async fn on_message(&self, msg: &dyn Message, ctx: &dyn Context) -> Result<()> { + async fn on_message(&self, msg: &R::Message, ctx: &R::Context) -> Result<()> { if !msg.content().starts_with(PREFIX) { return Ok(()); } @@ -100,7 +102,7 @@ impl GenkaiAuthBot { } } - async fn set_pgp(&self, msg: &dyn Message, ctx: &dyn Context, url: &str) -> Result<()> { + async fn set_pgp(&self, msg: &impl Message, ctx: &impl Context, url: &str) -> Result<()> { let verify_result = match self.verify_url(url) { Ok(_) => download_gpg_key(url).await, Err(e) => Err(e), @@ -127,7 +129,7 @@ impl GenkaiAuthBot { Ok(()) } - async fn token(&self, msg: &dyn Message, ctx: &dyn Context) -> Result<()> { + async fn token(&self, msg: &impl Message, ctx: &impl Context) -> Result<()> { let author = msg.author(); if self.db.get_token(author.id()).await?.is_some() { @@ -171,7 +173,7 @@ impl GenkaiAuthBot { Ok(()) } - async fn revoke(&self, msg: &dyn Message, ctx: &dyn Context) -> Result<()> { + async fn revoke(&self, msg: &impl Message, ctx: &impl Context) -> Result<()> { self.db .revoke_token(msg.author().id()) .await diff --git a/src/bot/genkai_point/formula/mod.rs b/src/bot/genkai_point/formula/mod.rs index 017ca73..7bf41f4 100644 --- a/src/bot/genkai_point/formula/mod.rs +++ b/src/bot/genkai_point/formula/mod.rs @@ -1,4 +1,4 @@ -use {self::v3::FormulaV3, crate::bot::genkai_point::model::Session}; +use {crate::bot::genkai_point::model::Session, v3::FormulaV3}; pub mod v1; pub mod v2; diff --git a/src/bot/genkai_point/mod.rs b/src/bot/genkai_point/mod.rs index 9ce9468..59865ee 100644 --- a/src/bot/genkai_point/mod.rs +++ b/src/bot/genkai_point/mod.rs @@ -11,10 +11,10 @@ use { }, model::{Session, UserStat}, }, - parse_command, ui, BotService, Context, Message, SendAttachment, SendMessage, + parse_command, ui, BotService, Context, Message, Runtime, SendAttachment, SendMessage, + User, }, anyhow::{Context as _, Result}, - async_trait::async_trait, chrono::{DateTime, Duration, Utc}, clap::ValueEnum, once_cell::sync::Lazy, @@ -119,43 +119,53 @@ fn parse_duration(s: &str) -> Result { Ok(d) } -#[async_trait] pub(crate) trait GenkaiPointDatabase: Send + Sync { /// Creates a new unclosed session if not exists. /// If the user's last session was closed before within 5minutes from now, clear its "left_at" field. /// If an unclosed session exists, leaves it untouched. - async fn create_new_session( + fn create_new_session( &self, user_id: u64, joined_at: DateTime, - ) -> Result; - async fn unclosed_session_exists(&self, user_id: u64) -> Result; - async fn close_session(&self, user_id: u64, left_at: DateTime) -> Result<()>; - async fn get_users_all_sessions(&self, user_id: u64) -> Result>; - async fn get_all_users_who_has_unclosed_session(&self) -> Result>; - async fn get_all_sessions(&self) -> Result>; - - async fn get_all_users_stats( + ) -> impl Future> + Send; + fn unclosed_session_exists(&self, user_id: u64) -> impl Future> + Send; + fn close_session( &self, - formula: &impl GenkaiPointFormula, - ) -> Result> { - let sessions = self.get_all_sessions().await?; - - let user_sessions = { - let mut map = HashMap::new(); - for session in sessions { - map.entry(session.user_id) - .or_insert_with(Vec::new) - .push(session); - } - map - }; + user_id: u64, + left_at: DateTime, + ) -> impl Future> + Send; + fn get_users_all_sessions( + &self, + user_id: u64, + ) -> impl Future>> + Send; + fn get_all_users_who_has_unclosed_session( + &self, + ) -> impl Future>> + Send; + fn get_all_sessions(&self) -> impl Future>> + Send; - user_sessions - .into_iter() - .flat_map(|(_, x)| UserStat::from_sessions(&x, formula).transpose()) - .collect::>() - .context("failed to calc userstat") + fn get_all_users_stats( + &self, + formula: &impl GenkaiPointFormula, + ) -> impl Future>> + Send { + async move { + let sessions = self.get_all_sessions().await?; + + let user_sessions = { + let mut map = HashMap::new(); + for session in sessions { + map.entry(session.user_id) + .or_insert_with(Vec::new) + .push(session); + } + map + }; + + user_sessions + .into_iter() + .flat_map(|(_, x)| UserStat::from_sessions(&x, formula).transpose()) + .collect::>() + .context("failed to calc userstat") + } } } @@ -191,7 +201,7 @@ impl GenkaiPointBot { // TODO: refactor needed async fn ranking( &self, - ctx: &dyn Context, + ctx: &impl Context, formula: &impl GenkaiPointFormula, by: &str, sort_comparator: C, @@ -263,7 +273,7 @@ impl GenkaiPointBot { Ok(()) } - async fn graph(&self, ctx: &dyn Context, n: u8) -> Result<()> { + async fn graph(&self, ctx: &impl Context, n: u8) -> Result<()> { let n = n.clamp(1, 11); let image = plot::plot(&self.db, ctx, &self.plotter, n as _).await?; @@ -290,7 +300,7 @@ impl GenkaiPointBot { async fn show( &self, - ctx: &dyn Context, + ctx: &impl Context, formula: &impl GenkaiPointFormula, user_id: u64, ) -> Result<()> { @@ -353,13 +363,12 @@ where }) } -#[async_trait] -impl BotService for GenkaiPointBot { +impl BotService for GenkaiPointBot { fn name(&self) -> &'static str { NAME } - async fn on_message(&self, msg: &dyn Message, ctx: &dyn Context) -> Result<()> { + async fn on_message(&self, msg: &R::Message, ctx: &R::Context) -> Result<()> { if !msg.content().starts_with(PREFIX) { return Ok(()); } @@ -418,7 +427,7 @@ impl BotService for GenkaiPointBot { Ok(()) } - async fn on_vc_join(&self, ctx: &dyn Context, user_id: u64) -> Result<()> { + async fn on_vc_join(&self, ctx: &R::Context, user_id: u64) -> Result<()> { let op = self .db .create_new_session(user_id, Utc::now()) @@ -447,7 +456,7 @@ impl BotService for GenkaiPointBot { Ok(()) } - async fn on_vc_leave(&self, ctx: &dyn Context, user_id: u64) -> Result<()> { + async fn on_vc_leave(&self, ctx: &R::Context, user_id: u64) -> Result<()> { self.db .close_session(user_id, Utc::now()) .await @@ -496,11 +505,7 @@ impl BotService for GenkaiPointBot { Ok(()) } - async fn on_vc_data_available( - &self, - _ctx: &dyn Context, - joined_user_ids: &[u64], - ) -> Result<()> { + async fn on_vc_data_available(&self, _ctx: &R::Context, joined_user_ids: &[u64]) -> Result<()> { for uid in joined_user_ids { let op = self .db diff --git a/src/bot/genkai_point/plot/mod.rs b/src/bot/genkai_point/plot/mod.rs index 51b9bf3..32ead89 100644 --- a/src/bot/genkai_point/plot/mod.rs +++ b/src/bot/genkai_point/plot/mod.rs @@ -20,7 +20,7 @@ pub(crate) mod charming; pub(super) async fn plot( db: &impl GenkaiPointDatabase, - ctx: &dyn Context, + ctx: &impl Context, plotter: &P, top: usize, ) -> Result>> { diff --git a/src/bot/gh/mod.rs b/src/bot/gh/mod.rs index d9550bb..fba00f8 100644 --- a/src/bot/gh/mod.rs +++ b/src/bot/gh/mod.rs @@ -1,7 +1,6 @@ use { - crate::bot::{parse_command, ui, BotService, Context, Message}, + crate::bot::{parse_command, ui, BotService, Context, Message, Runtime}, anyhow::{Context as _, Result}, - async_trait::async_trait, derivative::Derivative, once_cell::sync::Lazy, regex::Regex, @@ -59,7 +58,7 @@ pub struct GitHubCodePreviewBot; const MAX_PREVIEW_MSG_LENGTH: usize = 2000; impl GitHubCodePreviewBot { - async fn on_command(&self, message: &str, ctx: &dyn Context) -> Result<()> { + async fn on_command(&self, message: &str, ctx: &impl Context) -> Result<()> { use Command::*; let Some(parsed) = parse_command::(message, ctx).await? else { @@ -149,13 +148,12 @@ impl GitHubCodePreviewBot { } } -#[async_trait] -impl BotService for GitHubCodePreviewBot { +impl BotService for GitHubCodePreviewBot { fn name(&self) -> &'static str { NAME } - async fn on_message(&self, msg: &dyn Message, ctx: &dyn Context) -> anyhow::Result<()> { + async fn on_message(&self, msg: &R::Message, ctx: &R::Context) -> anyhow::Result<()> { if msg.content().starts_with(PREFIX) { return self.on_command(msg.content(), ctx).await; } @@ -310,7 +308,6 @@ mod test { pretty_assertions::assert_eq, std::{ future::Future, - pin::Pin, sync::atomic::{AtomicBool, Ordering}, }, }; @@ -318,16 +315,45 @@ mod test { async fn test(input: &'static str, output: impl Into>) { let output = output.into(); + struct Attach; + impl Attachment for Attach { + fn name(&self) -> &str { + unimplemented!() + } + fn size(&self) -> usize { + unimplemented!() + } + async fn download(&self) -> Result> { + unimplemented!() + } + } + + struct Usr; + impl User for Usr { + fn id(&self) -> u64 { + unimplemented!() + } + + fn name(&self) -> &str { + unimplemented!() + } + + async fn dm(&self, _msg: SendMessage<'_>) -> Result<()> { + unimplemented!() + } + } + struct Msg(&'static str); - #[async_trait] impl Message for Msg { + type Attachment = Attach; + type User = Usr; async fn reply(&self, _msg: &str) -> Result<()> { unimplemented!() } - fn author(&self) -> &dyn User { + fn author(&self) -> &Usr { unimplemented!() } - fn attachments(&self) -> &[&dyn Attachment] { + fn attachments(&self) -> &[Attach] { unimplemented!() } fn content(&self) -> &str { @@ -339,7 +365,6 @@ mod test { called: AtomicBool, expected: Option<&'static str>, } - #[async_trait] impl Context for Ctx { async fn send_message(&self, _: SendMessage<'_>) -> Result<()> { unimplemented!() @@ -353,10 +378,7 @@ mod test { unimplemented!() } - fn send_text_message<'a>( - &'a self, - text: &'a str, - ) -> Pin> + 'a>> { + fn send_text_message(&self, text: &str) -> impl Future> + Send { match self.expected { Some(expected) => { assert_eq!(text, expected); @@ -375,10 +397,19 @@ mod test { expected: output, }; - GitHubCodePreviewBot - .on_message(&Msg(input), &ctx) - .await - .unwrap(); + struct Rt; + impl Runtime for Rt { + type Message = Msg; + type Context = Ctx; + } + + >::on_message( + &GitHubCodePreviewBot, + &Msg(input), + &ctx, + ) + .await + .unwrap(); assert!(output.is_some() == ctx.called.load(Ordering::Relaxed)); } diff --git a/src/bot/meigen/mod.rs b/src/bot/meigen/mod.rs index 47f893d..71fc9fd 100644 --- a/src/bot/meigen/mod.rs +++ b/src/bot/meigen/mod.rs @@ -1,9 +1,9 @@ use { - crate::bot::{parse_command, ui, BotService, Context, IsUpdated, Message}, + crate::bot::{parse_command, ui, BotService, Context, IsUpdated, Message, Runtime, User}, anyhow::{Context as _, Result}, - async_trait::async_trait, model::{Meigen, MeigenId}, rusty_ponyo::KAWAEMON_DISCORD_USER_ID, + std::future::Future, }; pub mod model; @@ -17,19 +17,26 @@ pub struct FindOptions<'a> { pub random: bool, } -#[async_trait] pub trait MeigenDatabase: Send + Sync { - async fn save( + fn save( &self, author: impl Into + Send, content: impl Into + Send, - ) -> Result; - async fn load(&self, id: MeigenId) -> Result>; - async fn delete(&self, id: MeigenId) -> Result; - async fn search(&self, options: FindOptions<'_>) -> Result>; - async fn count(&self) -> Result; - async fn append_loved_user(&self, id: MeigenId, loved_user_id: u64) -> Result; - async fn remove_loved_user(&self, id: MeigenId, loved_user_id: u64) -> Result; + ) -> impl Future> + Send; + fn load(&self, id: MeigenId) -> impl Future>> + Send; + fn delete(&self, id: MeigenId) -> impl Future> + Send; + fn search(&self, options: FindOptions<'_>) -> impl Future>> + Send; + fn count(&self) -> impl Future> + Send; + fn append_loved_user( + &self, + id: MeigenId, + loved_user_id: u64, + ) -> impl Future> + Send; + fn remove_loved_user( + &self, + id: MeigenId, + loved_user_id: u64, + ) -> impl Future> + Send; } const NAME: &str = "rusty_ponyo::bot::meigen"; @@ -115,13 +122,12 @@ pub struct MeigenBot { db: D, } -#[async_trait] -impl BotService for MeigenBot { +impl BotService for MeigenBot { fn name(&self) -> &'static str { NAME } - async fn on_message(&self, msg: &dyn Message, ctx: &dyn Context) -> Result<()> { + async fn on_message(&self, msg: &R::Message, ctx: &R::Context) -> Result<()> { if !msg.content().starts_with(PREFIX) { return Ok(()); } diff --git a/src/bot/mod.rs b/src/bot/mod.rs index 5f8f546..071bf27 100644 --- a/src/bot/mod.rs +++ b/src/bot/mod.rs @@ -1,7 +1,6 @@ use { anyhow::{Context as _, Result}, - async_trait::async_trait, - std::{future::Future, pin::Pin}, + std::future::Future, }; /// 変更が生じた場合 true @@ -15,36 +14,41 @@ pub mod meigen; pub mod uo; pub mod vc_diff; -#[async_trait] +// Usage of GATs like this: +// type Message<'a>: Message + 'a; +// makes hard lifetime error +// repro: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=97640973cf3459848463dbd13ba8f951 +// issue: https://github.com/rust-lang/rust/issues/100013 + pub(crate) trait Message: Send + Sync { - async fn reply(&self, msg: &str) -> Result<()>; - fn author(&self) -> &dyn User; + type Attachment: Attachment; + type User: User; + + fn reply(&self, msg: &str) -> impl Future> + Send; + fn author(&self) -> &Self::User; fn content(&self) -> &str; - fn attachments(&self) -> &[&dyn Attachment]; + fn attachments(&self) -> &[Self::Attachment]; } -#[async_trait] pub(crate) trait Attachment: Send + Sync { fn name(&self) -> &str; fn size(&self) -> usize; - async fn download(&self) -> Result>; + fn download(&self) -> impl Future>> + Send; } -#[async_trait] pub(crate) trait User: Send + Sync { fn id(&self) -> u64; - #[allow(unused)] fn name(&self) -> &str; - async fn dm(&self, msg: SendMessage<'_>) -> Result<()>; - - fn dm_text<'a>( - &'a self, - text: &'a str, - ) -> Pin> + 'a>> { - self.dm(SendMessage { - content: text, - attachments: &[], - }) + fn dm(&self, msg: SendMessage<'_>) -> impl Future> + Send; + + fn dm_text(&self, text: &str) -> impl Future> + Send { + async move { + self.dm(SendMessage { + content: text, + attachments: &[], + }) + .await + } } } @@ -59,53 +63,67 @@ pub(crate) struct SendAttachment<'a> { pub(crate) data: &'a [u8], } -#[async_trait] pub(crate) trait Context: Send + Sync { - async fn send_message(&self, msg: SendMessage<'_>) -> Result<()>; - async fn get_user_name(&self, user_id: u64) -> Result; - async fn is_bot(&self, user_id: u64) -> Result; - - #[must_use = "Futures do nothing unless polled"] - fn send_text_message<'a>( - &'a self, - text: &'a str, - ) -> Pin> + 'a>> { - self.send_message(SendMessage { - content: text, - attachments: &[], - }) + fn send_message(&self, msg: SendMessage<'_>) -> impl Future> + Send; + fn get_user_name(&self, user_id: u64) -> impl Future> + Send; + fn is_bot(&self, user_id: u64) -> impl Future> + Send; + + fn send_text_message(&self, text: &str) -> impl Future> + Send { + async move { + self.send_message(SendMessage { + content: text, + attachments: &[], + }) + .await + } } } -#[async_trait] -pub(crate) trait BotService: Send + Sync { +pub trait Runtime { + type Message: Message; + type Context: Context; +} + +pub(crate) trait BotService: Send + Sync { fn name(&self) -> &'static str; - async fn on_message(&self, _msg: &dyn Message, _ctx: &dyn Context) -> Result<()> { - Ok(()) + fn on_message( + &self, + _msg: &R::Message, + _ctx: &R::Context, + ) -> impl Future> + Send { + async { Ok(()) } } // called on bot started and got who is currently joined to vc - async fn on_vc_data_available( + fn on_vc_data_available( &self, - _ctx: &dyn Context, + _ctx: &R::Context, _joined_user_ids: &[u64], - ) -> Result<()> { - Ok(()) + ) -> impl Future> + Send { + async { Ok(()) } } // called on user has joined to vc - async fn on_vc_join(&self, _ctx: &dyn Context, _user_id: u64) -> Result<()> { - Ok(()) + fn on_vc_join( + &self, + _ctx: &R::Context, + _user_id: u64, + ) -> impl Future> + Send { + async { Ok(()) } } // called on user has left from vc and not in any channel - async fn on_vc_leave(&self, _ctx: &dyn Context, _user_id: u64) -> Result<()> { - Ok(()) + fn on_vc_leave( + &self, + _ctx: &R::Context, + _user_id: u64, + ) -> impl Future> + Send { + async { Ok(()) } } } -async fn parse_command(message: &str, ctx: &dyn Context) -> Result> { +async fn parse_command(message: &str, ctx: &impl Context) -> Result> { let words = match shellwords::split(message) { Ok(w) => w, Err(_) => { diff --git a/src/bot/uo/mod.rs b/src/bot/uo/mod.rs index 210c4a1..b303191 100644 --- a/src/bot/uo/mod.rs +++ b/src/bot/uo/mod.rs @@ -1,6 +1,5 @@ -use crate::bot::{parse_command, ui, BotService, Context, Message}; +use crate::bot::{parse_command, ui, BotService, Context, Message, Runtime, User}; use anyhow::{Context as _, Result}; -use async_trait::async_trait; use rusty_ponyo::KAWAEMON_DISCORD_USER_ID; use tokio::sync::Mutex; @@ -39,13 +38,12 @@ impl UoBot { } } -#[async_trait] -impl BotService for UoBot { +impl BotService for UoBot { fn name(&self) -> &'static str { NAME } - async fn on_message(&self, msg: &dyn Message, ctx: &dyn Context) -> Result<()> { + async fn on_message(&self, msg: &R::Message, ctx: &R::Context) -> Result<()> { { let p = *self.prob_percent.lock().await; if rand::random::() < (p as f64 / 100.0) { diff --git a/src/bot/vc_diff/mod.rs b/src/bot/vc_diff/mod.rs index 8ebad6d..541c33c 100644 --- a/src/bot/vc_diff/mod.rs +++ b/src/bot/vc_diff/mod.rs @@ -1,7 +1,6 @@ use { - crate::bot::{parse_command, ui, BotService, Context, Message}, + crate::bot::{parse_command, ui, BotService, Context, Message, Runtime}, anyhow::{Context as _, Result}, - async_trait::async_trait, chrono::{DateTime, Duration, Utc}, once_cell::sync::Lazy, tokio::sync::Mutex, @@ -62,7 +61,7 @@ impl VcDiffBot { true } - async fn notify(&self, ctx: &dyn Context, user_id: u64, joined: bool) -> Result<()> { + async fn notify(&self, ctx: &impl Context, user_id: u64, joined: bool) -> Result<()> { if !self.should_notify().await { return Ok(()); } @@ -86,13 +85,12 @@ impl VcDiffBot { } } -#[async_trait] -impl BotService for VcDiffBot { +impl BotService for VcDiffBot { fn name(&self) -> &'static str { NAME } - async fn on_message(&self, msg: &dyn Message, ctx: &dyn Context) -> Result<()> { + async fn on_message(&self, msg: &R::Message, ctx: &R::Context) -> Result<()> { if !msg.content().starts_with(PREFIX) { return Ok(()); } @@ -131,11 +129,11 @@ impl BotService for VcDiffBot { Ok(()) } - async fn on_vc_join(&self, ctx: &dyn Context, user_id: u64) -> Result<()> { + async fn on_vc_join(&self, ctx: &R::Context, user_id: u64) -> Result<()> { self.notify(ctx, user_id, true).await } - async fn on_vc_leave(&self, ctx: &dyn Context, user_id: u64) -> Result<()> { + async fn on_vc_leave(&self, ctx: &R::Context, user_id: u64) -> Result<()> { self.notify(ctx, user_id, false).await } } diff --git a/src/client/console.rs b/src/client/console.rs index 8c14112..5379f62 100644 --- a/src/client/console.rs +++ b/src/client/console.rs @@ -1,7 +1,9 @@ use { - crate::bot::{Attachment, BotService, Context, Message, SendMessage, User}, + crate::{ + bot::{Attachment, BotService, Context, Message, Runtime, SendMessage, User}, + client::{ListCons, ListNil, ServiceList, ServiceVisitor}, + }, anyhow::Result, - async_trait::async_trait, std::{ io::{stdin, stdout, Write}, path::Path, @@ -9,21 +11,24 @@ use { }, }; -pub(crate) struct ConsoleClient<'a> { - services: Vec>, +pub(crate) struct ConsoleClient> { + services: L, } -impl<'a> ConsoleClient<'a> { +impl ConsoleClient { pub fn new() -> Self { - Self { services: vec![] } + Self { services: ListNil } } +} - pub fn add_service(&mut self, service: S) -> &mut Self +impl> ConsoleClient { + pub fn add_service(self, service: S) -> ConsoleClient> where - S: BotService + Send + 'a, + S: BotService + Send, { - self.services.push(Box::new(service)); - self + ConsoleClient { + services: self.services.append(service), + } } pub async fn run(self) -> Result<()> { @@ -68,54 +73,73 @@ impl<'a> ConsoleClient<'a> { continue; } - ( - content, - attachments.iter().map(|x| x as _).collect::>(), - ) + (content, attachments) } else { (input, vec![]) } }; - for service in self.services.iter() { - let begin = Instant::now(); - - let ctx = ConsoleContext { - service_name: service.name(), - begin, - }; + struct Visitor { + content: String, + attachments: Vec, + } + impl ServiceVisitor for Visitor { + type Runtime = ConsoleRuntime; + async fn visit(&self, service: &impl BotService) { + let begin = Instant::now(); - let message = ConsoleMessage { - service_name: service.name(), - begin, - content: content.clone(), - attachments: attachments.clone(), - user: ConsoleUser { + let ctx = ConsoleContext { service_name: service.name(), begin, - }, - }; + }; + + let message = ConsoleMessage { + service_name: service.name().to_owned(), + begin, + content: self.content.clone(), + attachments: self.attachments.clone(), + user: ConsoleUser { + service_name: service.name().to_owned(), + begin, + }, + }; - let result = service.on_message(&message, &ctx).await; + let result = service.on_message(&message, &ctx).await; - if let Err(e) = result { - println!("(ConsoleClient): error while calling service: {e:?}",); + if let Err(e) = result { + println!("(ConsoleClient): error while calling service: {e:?}",); + } } } + + self.services + .visit(&Visitor { + content, + attachments, + }) + .await; } } } -struct ConsoleMessage<'a> { - service_name: &'a str, +pub struct ConsoleRuntime; +impl Runtime for ConsoleRuntime { + type Message = ConsoleMessage; + type Context = ConsoleContext; +} + +pub struct ConsoleMessage { + service_name: String, begin: Instant, content: String, - attachments: Vec<&'a dyn Attachment>, - user: ConsoleUser<'a>, + attachments: Vec, + user: ConsoleUser, } -#[async_trait] -impl Message for ConsoleMessage<'_> { +impl Message for ConsoleMessage { + type Attachment = ConsoleAttachment; + type User = ConsoleUser; + async fn reply(&self, content: &str) -> Result<()> { println!( "({}, reply, {}ms): {}", @@ -130,22 +154,21 @@ impl Message for ConsoleMessage<'_> { &self.content } - fn attachments(&self) -> &[&dyn Attachment] { + fn attachments(&self) -> &[ConsoleAttachment] { &self.attachments } - fn author(&self) -> &dyn crate::bot::User { + fn author(&self) -> &ConsoleUser { &self.user } } -struct ConsoleUser<'a> { - service_name: &'a str, +pub struct ConsoleUser { + service_name: String, begin: Instant, } -#[async_trait] -impl<'a> User for ConsoleUser<'a> { +impl User for ConsoleUser { fn id(&self) -> u64 { 0 } @@ -166,22 +189,25 @@ impl<'a> User for ConsoleUser<'a> { } } -struct ConsoleAttachment<'a> { - path: &'a str, +#[derive(Clone)] +pub struct ConsoleAttachment { + path: String, content: Vec, } -impl<'a> ConsoleAttachment<'a> { - fn load(path: &'a str) -> Result { +impl ConsoleAttachment { + fn load(path: &str) -> Result { let content = std::fs::read(path)?; - Ok(ConsoleAttachment { content, path }) + Ok(ConsoleAttachment { + content, + path: path.to_owned(), + }) } } -#[async_trait] -impl<'a> Attachment for ConsoleAttachment<'a> { +impl Attachment for ConsoleAttachment { fn name(&self) -> &str { - Path::new(self.path).file_name().unwrap().to_str().unwrap() + Path::new(&self.path).file_name().unwrap().to_str().unwrap() } fn size(&self) -> usize { @@ -193,12 +219,11 @@ impl<'a> Attachment for ConsoleAttachment<'a> { } } -struct ConsoleContext { +pub struct ConsoleContext { service_name: &'static str, begin: Instant, } -#[async_trait] impl Context for ConsoleContext { async fn send_message(&self, msg: SendMessage<'_>) -> Result<()> { println!( diff --git a/src/client/discord.rs b/src/client/discord.rs index 09b5534..5e8a874 100644 --- a/src/client/discord.rs +++ b/src/client/discord.rs @@ -1,9 +1,13 @@ use { - crate::bot::{Attachment, BotService, Context, Message, SendMessage, User}, + super::ServiceVisitor, + crate::{ + bot::{Attachment, BotService, Context, Message, Runtime, SendMessage, User}, + client::{ListCons, ListNil, ServiceList}, + }, anyhow::{Context as _, Result}, - async_trait::async_trait, rusty_ponyo::{APPROVERS_DEFAULT_CHANNEL_ID, APPROVERS_GUILD_ID}, serenity::{ + async_trait, builder::{CreateAttachment, CreateMessage}, model::{ channel::{Attachment as SerenityAttachment, Message as SerenityMessage}, @@ -34,21 +38,23 @@ fn submit_signal_handler(client: &Client, waiter: impl Future + Send + 'static) }); } -pub(crate) struct DiscordClient { - services: Vec>, +pub(crate) struct DiscordClient> { + services: L, } - -impl DiscordClient { +impl DiscordClient { pub fn new() -> Self { - Self { services: vec![] } + Self { services: ListNil } } +} - pub fn add_service(&mut self, service: S) -> &mut Self +impl + Send + Sync + 'static> DiscordClient { + pub fn add_service(self, service: S) -> DiscordClient> where - S: BotService + Send + 'static, + S: BotService + Send + 'static, { - self.services.push(Box::new(service)); - self + DiscordClient { + services: self.services.append(service), + } } pub async fn run(self, token: &str) -> Result<()> { @@ -81,63 +87,121 @@ impl DiscordClient { } } -// TODO: should be configurable - -struct EvHandlerInner { - services: Vec>, +struct EvHandlerInner> { + services: L, vc_joined_users: Mutex>, - nickname_cache: RwLock, - is_bot_cache: RwLock, + nickname_cache: Arc>, + is_bot_cache: Arc>, +} + +struct EvHandler> { + inner: Arc>, } -struct EvHandler { - inner: Arc, +// because current Rust cannot do this: +// impl Fn(&impl BotService) -> impl Future; +mod visitors { + use super::*; + pub trait ForEachService: Send + Sync { + const OP: &'static str; + fn accept( + &self, + s: &impl BotService, + ) -> impl Future> + Send; + } + + pub struct MessageVisitor<'a> { + pub msg: &'a DiscordMessage, + pub ctx: &'a DiscordContext, + } + impl<'a> ForEachService for MessageVisitor<'a> { + const OP: &'static str = "on_message"; + async fn accept(&self, s: &impl BotService) -> Result<()> { + s.on_message(self.msg, self.ctx).await + } + } + + pub struct VcDataAvailableVisitor<'a> { + pub ctx: &'a DiscordContext, + pub users: &'a [u64], + } + impl<'a> ForEachService for VcDataAvailableVisitor<'a> { + const OP: &'static str = "on_vc_data_avaialble"; + async fn accept(&self, s: &impl BotService) -> Result<()> { + s.on_vc_data_available(self.ctx, self.users).await + } + } + + pub struct VcJoinVisitor<'a> { + pub ctx: &'a DiscordContext, + pub uid: u64, + } + impl<'a> ForEachService for VcJoinVisitor<'a> { + const OP: &'static str = "on_vc_join"; + async fn accept(&self, s: &impl BotService) -> Result<()> { + s.on_vc_join(self.ctx, self.uid).await + } + } + + pub struct VcLeaveVisitor<'a> { + pub ctx: &'a DiscordContext, + pub uid: u64, + } + impl<'a> ForEachService for VcLeaveVisitor<'a> { + const OP: &'static str = "on_vc_leave"; + async fn accept(&self, s: &impl BotService) -> Result<()> { + s.on_vc_leave(self.ctx, self.uid).await + } + } } -impl EvHandler { - fn new(services: Vec>) -> Self { +impl + 'static> EvHandler { + fn new(services: L) -> Self { Self { inner: Arc::new(EvHandlerInner { services, vc_joined_users: Mutex::new(HashSet::new()), - nickname_cache: RwLock::new(NicknameCache(HashMap::new())), - is_bot_cache: RwLock::new(IsBotCache(HashMap::new())), + nickname_cache: Arc::new(RwLock::new(NicknameCache(HashMap::new()))), + is_bot_cache: Arc::new(RwLock::new(IsBotCache(HashMap::new()))), }), } } - async fn do_for_each_service<'a, F, Fu>( + async fn do_for_each_service<'a>( ctx: &'a SerenityContext, - inner: &'a EvHandlerInner, - op: &'static str, - f: F, - ) where - Fu: Future> + Send + 'a, - F: Fn(&'a dyn BotService) -> Fu, - { - for service in &inner.services { - let result = f(service.as_ref()).await; - - if let Err(e) = result { - tracing::error!( - "Service({})::{} returned error: {:?}", - service.name(), - op, - e - ); - - SerenityChannelId::new(APPROVERS_DEFAULT_CHANNEL_ID) - .say( - &ctx, - &format!("Unexpected error reported from \"{}\". Read log <@!391857452360007680>", service.name()), - ) - .await - .ok(); + inner: &'a EvHandlerInner, + f: impl visitors::ForEachService, + ) { + inner.services.visit(&Visitor { ctx, f }).await; + struct Visitor<'a, F: visitors::ForEachService> { + ctx: &'a SerenityContext, + f: F, + } + impl<'a, F: visitors::ForEachService> ServiceVisitor for Visitor<'a, F> { + type Runtime = DiscordRuntime; + async fn visit(&self, service: &impl BotService) { + let result = self.f.accept(service).await; + + if let Err(e) = result { + tracing::error!( + "Service({})::{} returned error: {e:?}", + F::OP, + service.name() + ); + + SerenityChannelId::new(APPROVERS_DEFAULT_CHANNEL_ID) + .say( + &self.ctx, + &format!("Unexpected error reported from \"{}\". Read log <@!391857452360007680>", service.name()), + ) + .await + .ok(); + } } } } - async fn initial_validate_vc_cache(inner: Arc, ctx: SerenityContext) { + async fn initial_validate_vc_cache(inner: Arc>, ctx: SerenityContext) { let mut interval = interval(Duration::from_secs(1)); loop { @@ -171,9 +235,14 @@ impl EvHandler { &inner.is_bot_cache, ); - Self::do_for_each_service(&ctx, &inner, "on_vc_data_available", |s| { - s.on_vc_data_available(&converted_ctx, &joined_users) - }) + Self::do_for_each_service( + &ctx, + &inner, + visitors::VcDataAvailableVisitor { + ctx: &converted_ctx, + users: &joined_users, + }, + ) .await; tracing::info!("vc status checking on startup complete"); @@ -183,7 +252,7 @@ impl EvHandler { tokio::spawn(Self::validate_vc_cache_loop(inner, ctx)); } - async fn validate_vc_cache_loop(inner: Arc, ctx: SerenityContext) { + async fn validate_vc_cache_loop(inner: Arc>, ctx: SerenityContext) { let mut interval = interval(Duration::from_secs(30)); loop { @@ -224,9 +293,14 @@ impl EvHandler { self_state.insert(uid); tracing::info!("user({}) has actually joined to vc", uid.get()); - Self::do_for_each_service(&ctx, &inner, "on_vc_join", |s| { - s.on_vc_join(&converted_ctx, uid.get()) - }) + Self::do_for_each_service( + &ctx, + &inner, + visitors::VcJoinVisitor { + ctx: &converted_ctx, + uid: uid.get(), + }, + ) .await; } @@ -235,9 +309,14 @@ impl EvHandler { self_state.remove(&uid); - Self::do_for_each_service(&ctx, &inner, "on_vc_leave", |s| { - s.on_vc_leave(&converted_ctx, uid.get()) - }) + Self::do_for_each_service( + &ctx, + &inner, + visitors::VcLeaveVisitor { + ctx: &converted_ctx, + uid: uid.get(), + }, + ) .await; } } @@ -245,7 +324,7 @@ impl EvHandler { } #[async_trait] -impl EventHandler for EvHandler { +impl + Send + Sync + 'static> EventHandler for EvHandler { async fn ready(&self, ctx: SerenityContext, ready: Ready) { tracing::info!("DiscordBot({}) is connected!", ready.user.name); @@ -286,9 +365,14 @@ impl EventHandler for EvHandler { self_state.insert(user_id); - Self::do_for_each_service(&ctx, &self.inner, "on_vc_join", |s| { - s.on_vc_join(&converted_ctx, user_id.get()) - }) + Self::do_for_each_service( + &ctx, + &self.inner, + visitors::VcJoinVisitor { + ctx: &converted_ctx, + uid: user_id.get(), + }, + ) .await; } @@ -298,9 +382,14 @@ impl EventHandler for EvHandler { self_state.remove(&user_id); - Self::do_for_each_service(&ctx, &self.inner, "on_vc_leave", |s| { - s.on_vc_leave(&converted_ctx, user_id.get()) - }) + Self::do_for_each_service( + &ctx, + &self.inner, + visitors::VcLeaveVisitor { + ctx: &converted_ctx, + uid: user_id.get(), + }, + ) .await; } @@ -319,7 +408,8 @@ impl EventHandler for EvHandler { let converted_attachments = message .attachments - .iter() + .clone() + .into_iter() .map(DiscordAttachment) .collect::>(); @@ -330,17 +420,6 @@ impl EventHandler for EvHandler { .0 .insert(message.author.id, message.author.name.clone()); - let converted_message = DiscordMessage { - ctx: &ctx, - message: &message, - attachments: converted_attachments.iter().map(|x| x as _).collect(), - author: DiscordAuthor { - id: message.author.id.get(), - name: &message.author.name, - ctx: &ctx, - }, - }; - let converted_context = DiscordContext::from_serenity( &ctx, message.channel_id, @@ -348,26 +427,50 @@ impl EventHandler for EvHandler { &self.inner.is_bot_cache, ); - Self::do_for_each_service(&ctx, &self.inner, "on_message", |s| { - s.on_message(&converted_message, &converted_context) - }) + let converted_message = DiscordMessage { + ctx: ctx.clone(), + attachments: converted_attachments, + author: DiscordAuthor { + id: message.author.id.get(), + name: message.author.name.clone(), + ctx: ctx.clone(), + }, + message, + }; + + Self::do_for_each_service( + &ctx, + &self.inner, + visitors::MessageVisitor { + msg: &converted_message, + ctx: &converted_context, + }, + ) .await; } } +pub struct DiscordRuntime; +impl Runtime for DiscordRuntime { + type Message = DiscordMessage; + type Context = DiscordContext; +} + struct NicknameCache(HashMap); struct IsBotCache(HashMap); -struct DiscordMessage<'a> { - ctx: &'a SerenityContext, - message: &'a SerenityMessage, - attachments: Vec<&'a dyn Attachment>, - author: DiscordAuthor<'a>, +pub struct DiscordMessage { + ctx: SerenityContext, + message: SerenityMessage, + attachments: Vec, + author: DiscordAuthor, } -#[async_trait] -impl Message for DiscordMessage<'_> { +impl Message for DiscordMessage { + type Attachment = DiscordAttachment; + type User = DiscordAuthor; + async fn reply(&self, text: &str) -> Result<()> { self.message .reply_ping(&self.ctx.http, text) @@ -380,30 +483,29 @@ impl Message for DiscordMessage<'_> { &self.message.content } - fn attachments(&self) -> &[&dyn Attachment] { + fn attachments(&self) -> &[DiscordAttachment] { &self.attachments } - fn author(&self) -> &dyn User { + fn author(&self) -> &DiscordAuthor { &self.author } } -struct DiscordAuthor<'a> { +pub struct DiscordAuthor { id: u64, #[allow(unused)] - name: &'a str, - ctx: &'a SerenityContext, + name: String, + ctx: SerenityContext, } -#[async_trait] -impl<'a> User for DiscordAuthor<'a> { +impl User for DiscordAuthor { fn id(&self) -> u64 { self.id } fn name(&self) -> &str { - self.name + &self.name } async fn dm(&self, msg: SendMessage<'_>) -> Result<()> { @@ -416,10 +518,10 @@ impl<'a> User for DiscordAuthor<'a> { let msg = CreateMessage::new().content(msg.content); SerenityUserId::new(self.id) - .create_dm_channel(self.ctx) + .create_dm_channel(&self.ctx) .await .context("failed to create DM channel")? - .send_files(self.ctx, files, msg) + .send_files(&self.ctx, files, msg) .await .context("failed to send DM")?; @@ -427,10 +529,9 @@ impl<'a> User for DiscordAuthor<'a> { } } -struct DiscordAttachment<'a>(&'a SerenityAttachment); +pub struct DiscordAttachment(SerenityAttachment); -#[async_trait] -impl Attachment for DiscordAttachment<'_> { +impl Attachment for DiscordAttachment { fn name(&self) -> &str { &self.0.filename } @@ -447,31 +548,30 @@ impl Attachment for DiscordAttachment<'_> { } } -struct DiscordContext<'a> { - origin: &'a SerenityContext, +pub struct DiscordContext { + origin: SerenityContext, channel_id: SerenityChannelId, - nickname_cache: &'a RwLock, - is_bot_cache: &'a RwLock, + nickname_cache: Arc>, + is_bot_cache: Arc>, } -impl<'a> DiscordContext<'a> { +impl DiscordContext { fn from_serenity( - origin: &'a SerenityContext, + origin: &SerenityContext, channel_id: impl Into, - nickname_cache: &'a RwLock, - is_bot_cache: &'a RwLock, + nickname_cache: &Arc>, + is_bot_cache: &Arc>, ) -> Self { Self { - origin, + origin: origin.clone(), channel_id: channel_id.into(), - nickname_cache, - is_bot_cache, + nickname_cache: Arc::clone(nickname_cache), + is_bot_cache: Arc::clone(is_bot_cache), } } } -#[async_trait] -impl Context for DiscordContext<'_> { +impl Context for DiscordContext { async fn send_message(&self, msg: SendMessage<'_>) -> Result<()> { let files = msg .attachments @@ -497,7 +597,7 @@ impl Context for DiscordContext<'_> { } let user = user_id - .to_user(self.origin) + .to_user(&self.origin) .await .context("failed to get username from discord")?; @@ -509,7 +609,7 @@ impl Context for DiscordContext<'_> { self.is_bot_cache.write().await.0.insert(user_id, user.bot); - return Ok(user.name); + Ok(user.name) } async fn is_bot(&self, user_id: u64) -> Result { @@ -520,7 +620,7 @@ impl Context for DiscordContext<'_> { } let user = user_id - .to_user(self.origin) + .to_user(&self.origin) .await .context("failed to get username from discord")?; @@ -532,6 +632,6 @@ impl Context for DiscordContext<'_> { self.is_bot_cache.write().await.0.insert(user_id, user.bot); - return Ok(user.bot); + Ok(user.bot) } } diff --git a/src/client/mod.rs b/src/client/mod.rs index 211269e..9e5a338 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -1,5 +1,42 @@ +use std::{future::Future, marker::PhantomData}; + +use crate::bot::{BotService, Runtime}; + #[cfg(feature = "console_client")] pub mod console; #[cfg(feature = "discord_client")] pub mod discord; + +pub trait ServiceVisitor: Send + Sync { + type Runtime: Runtime; + fn visit(&self, service: &impl BotService) -> impl Future + Send; +} + +pub trait ServiceList: Sized + Send + Sync { + fn append>(self, s: S) -> ListCons { + ListCons { + service: s, + child: self, + _phantom: PhantomData, + } + } + fn visit(&self, visitor: &impl ServiceVisitor) -> impl Future + Send; +} + +pub struct ListNil; +impl ServiceList for ListNil { + async fn visit(&self, _visitor: &impl ServiceVisitor) {} +} + +pub struct ListCons, C: ServiceList> { + service: S, + child: C, + _phantom: PhantomData R>, +} +impl, C: ServiceList> ServiceList for ListCons { + async fn visit(&self, visitor: &impl ServiceVisitor) { + self.child.visit(visitor).await; + visitor.visit(&self.service).await; + } +} diff --git a/src/db/mem.rs b/src/db/mem.rs index 9f6d465..c2126eb 100644 --- a/src/db/mem.rs +++ b/src/db/mem.rs @@ -11,7 +11,6 @@ use { IsUpdated, }, anyhow::{anyhow, Context as _, Result}, - async_trait::async_trait, chrono::{DateTime, Duration, Utc}, rand::seq::SliceRandom, serde::Serialize, @@ -62,7 +61,6 @@ impl MemoryDBInner { } } -#[async_trait] impl MessageAliasDatabase for MemoryDB { async fn save(&self, alias: MessageAlias) -> Result<()> { let mut me = self.inner().await; @@ -124,7 +122,6 @@ impl MessageAliasDatabase for MemoryDB { } } -#[async_trait] impl GenkaiPointDatabase for MemoryDB { async fn create_new_session( &self, @@ -228,7 +225,6 @@ struct AuthEntry { token: Option, } -#[async_trait] impl GenkaiAuthDatabase for MemoryDB { async fn register_pgp_key(&self, user_id: u64, key: &str) -> Result<()> { self.inner() @@ -282,7 +278,6 @@ impl GenkaiAuthDatabase for MemoryDB { } } -#[async_trait] impl MeigenDatabase for MemoryDB { async fn save( &self, diff --git a/src/db/mongodb/mod.rs b/src/db/mongodb/mod.rs index c6c79a4..3cd62e8 100644 --- a/src/db/mongodb/mod.rs +++ b/src/db/mongodb/mod.rs @@ -16,7 +16,6 @@ use { db::mongodb::model::{GenkaiAuthData, MongoMeigen, MongoMessageAlias, MongoSession}, }, anyhow::{bail, Context as _, Result}, - async_trait::async_trait, chrono::{DateTime, Duration, Utc}, mongodb::{ bson::{self, doc, oid::ObjectId, Document}, @@ -51,7 +50,6 @@ const GENKAI_POINT_COLLECTION_NAME: &str = "GenkaiPoint"; const GENKAI_AUTH_COLLECTION_NAME: &str = "GenkaiAuth"; const MEIGEN_COLLECTION_NAME: &str = "Meigen"; -#[async_trait] impl MessageAliasDatabase for MongoDb { async fn save(&self, alias: MessageAlias) -> Result<()> { self.inner @@ -163,7 +161,6 @@ impl MongoDb { } } -#[async_trait] impl GenkaiPointDatabase for MongoDb { async fn create_new_session( &self, @@ -317,7 +314,6 @@ impl GenkaiPointDatabase for MongoDb { } } -#[async_trait] impl GenkaiAuthDatabase for MongoDb { async fn register_pgp_key(&self, user_id: u64, key: &str) -> Result<()> { let user_id = user_id.to_string(); @@ -408,7 +404,6 @@ impl MongoDb { } } -#[async_trait] impl MeigenDatabase for MongoDb { async fn save( &self, diff --git a/src/main.rs b/src/main.rs index 22ece54..a698ce4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,9 +43,9 @@ async fn async_main() -> Result<()> { let remote_db = crate::db::mongodb::MongoDb::new(&env_var("MONGODB_ATLAS_URI")?).await?; #[cfg(feature = "console_client")] - let mut client = crate::client::console::ConsoleClient::new(); + let client = crate::client::console::ConsoleClient::new(); #[cfg(feature = "discord_client")] - let mut client = crate::client::discord::DiscordClient::new(); + let client = crate::client::discord::DiscordClient::new(); #[cfg(feature = "plot_plotters")] let plotter = plot::plotters::Plotters::new(); @@ -59,7 +59,7 @@ async fn async_main() -> Result<()> { .map(|x| x.to_string()) .collect(); - client + let client = client .add_service(MessageAliasBot::new(local_db.clone())) .add_service(GenkaiPointBot::new(local_db.clone(), plotter)) .add_service(GitHubCodePreviewBot) @@ -69,7 +69,7 @@ async fn async_main() -> Result<()> { #[cfg(feature = "console_client")] { - client.add_service(UoBot::new()); + let client = client.add_service(UoBot::new()); client.run().await?; } #[cfg(feature = "discord_client")] @@ -78,8 +78,7 @@ async fn async_main() -> Result<()> { let base = tokio::spawn(async move { client.run(&token).await }); let token = env_var("DISCORD_UO_TOKEN")?; - let mut uo_client = crate::client::discord::DiscordClient::new(); - uo_client.add_service(UoBot::new()); + let uo_client = crate::client::discord::DiscordClient::new().add_service(UoBot::new()); let uo = tokio::spawn(async move { uo_client.run(&token).await }); tokio::select! { From b7e590554931bd2403a3a939b83d11d88f9bc2bb Mon Sep 17 00:00:00 2001 From: kawaemon Date: Sun, 1 Dec 2024 16:35:36 +0900 Subject: [PATCH 4/5] refactor: pub(crate) -> pub --- src/bot/alias/mod.rs | 8 ++++---- src/bot/alias/model.rs | 18 ++++++++--------- src/bot/auth/mod.rs | 6 +++--- src/bot/genkai_point/formula/mod.rs | 12 ++++++------ src/bot/genkai_point/formula/v1.rs | 2 +- src/bot/genkai_point/formula/v2.rs | 2 +- src/bot/genkai_point/formula/v3.rs | 2 +- src/bot/genkai_point/mod.rs | 16 +++++++-------- src/bot/genkai_point/model.rs | 26 ++++++++++++------------- src/bot/genkai_point/plot/charming.rs | 4 ++-- src/bot/genkai_point/plot/matplotlib.rs | 4 ++-- src/bot/genkai_point/plot/mod.rs | 6 +++--- src/bot/genkai_point/plot/plotters.rs | 4 ++-- src/bot/mod.rs | 22 ++++++++++----------- src/bot/uo/mod.rs | 2 +- src/bot/vc_diff/mod.rs | 2 +- src/client/console.rs | 2 +- src/client/discord.rs | 2 +- src/db/mem.rs | 6 +++--- src/db/mongodb/mod.rs | 4 ++-- src/db/mongodb/model.rs | 4 ++-- 21 files changed, 77 insertions(+), 77 deletions(-) diff --git a/src/bot/alias/mod.rs b/src/bot/alias/mod.rs index 9461c2e..7405770 100644 --- a/src/bot/alias/mod.rs +++ b/src/bot/alias/mod.rs @@ -1,5 +1,5 @@ mod command; -pub(crate) mod model; +pub mod model; use { crate::bot::{ @@ -50,7 +50,7 @@ enum Command { }, } -pub(crate) trait MessageAliasDatabase: Send + Sync { +pub trait MessageAliasDatabase: Send + Sync { fn save(&self, alias: MessageAlias) -> impl Future> + Send; fn get(&self, key: &str) -> impl Future>> + Send; fn get_and_increment_usage_count( @@ -63,7 +63,7 @@ pub(crate) trait MessageAliasDatabase: Send + Sync { -> impl Future>> + Send; } -pub(crate) struct MessageAliasBot { +pub struct MessageAliasBot { db: D, } @@ -92,7 +92,7 @@ impl BotService for MessageAliasBot { } impl MessageAliasBot { - pub(crate) fn new(db: D) -> Self { + pub fn new(db: D) -> Self { Self { db } } diff --git a/src/bot/alias/model.rs b/src/bot/alias/model.rs index bc70f33..50749dd 100644 --- a/src/bot/alias/model.rs +++ b/src/bot/alias/model.rs @@ -4,16 +4,16 @@ use { }; #[derive(Clone, Serialize)] -pub(crate) struct MessageAlias { - pub(crate) key: String, - pub(crate) message: String, - pub(crate) attachments: Vec, - pub(crate) usage_count: u32, - pub(crate) created_at: DateTime, +pub struct MessageAlias { + pub key: String, + pub message: String, + pub attachments: Vec, + pub usage_count: u32, + pub created_at: DateTime, } #[derive(Clone, Serialize)] -pub(crate) struct MessageAliasAttachment { - pub(crate) name: String, - pub(crate) data: Vec, +pub struct MessageAliasAttachment { + pub name: String, + pub data: Vec, } diff --git a/src/bot/auth/mod.rs b/src/bot/auth/mod.rs index ecfb3d6..f10d60d 100644 --- a/src/bot/auth/mod.rs +++ b/src/bot/auth/mod.rs @@ -49,7 +49,7 @@ enum SetCommand { }, } -pub(crate) trait GenkaiAuthDatabase: Send + Sync { +pub trait GenkaiAuthDatabase: Send + Sync { fn register_pgp_key(&self, user_id: u64, cert: &str) -> impl Future> + Send; fn get_pgp_key(&self, user_id: u64) -> impl Future>> + Send; @@ -63,7 +63,7 @@ pub(crate) trait GenkaiAuthDatabase: Send + Sync { fn get_token(&self, user_id: u64) -> impl Future>> + Send; } -pub(crate) struct GenkaiAuthBot { +pub struct GenkaiAuthBot { db: D, pgp_pubkey_source_domain_whitelist: Vec, } @@ -95,7 +95,7 @@ impl BotService for GenkaiAuthBot { } impl GenkaiAuthBot { - pub(crate) fn new(db: D, pubkey_whitelist: Vec) -> Self { + pub fn new(db: D, pubkey_whitelist: Vec) -> Self { Self { db, pgp_pubkey_source_domain_whitelist: pubkey_whitelist, diff --git a/src/bot/genkai_point/formula/mod.rs b/src/bot/genkai_point/formula/mod.rs index 7bf41f4..39e15b3 100644 --- a/src/bot/genkai_point/formula/mod.rs +++ b/src/bot/genkai_point/formula/mod.rs @@ -4,21 +4,21 @@ pub mod v1; pub mod v2; pub mod v3; -pub(crate) trait GenkaiPointFormula: Send + Sync + 'static { +pub trait GenkaiPointFormula: Send + Sync + 'static { fn name(&self) -> &'static str; fn calc(&self, sessions: &[Session]) -> GenkaiPointFormulaOutput; } -pub(crate) struct GenkaiPointFormulaOutput { - pub(crate) point: u64, - pub(crate) efficiency: f64, +pub struct GenkaiPointFormulaOutput { + pub point: u64, + pub efficiency: f64, } -pub(crate) fn default_formula() -> impl GenkaiPointFormula { +pub fn default_formula() -> impl GenkaiPointFormula { FormulaV3 } -pub(crate) struct DynGenkaiPointFormula(pub Box); +pub struct DynGenkaiPointFormula(pub Box); impl GenkaiPointFormula for DynGenkaiPointFormula { fn name(&self) -> &'static str { diff --git a/src/bot/genkai_point/formula/v1.rs b/src/bot/genkai_point/formula/v1.rs index 4010d94..dc0b788 100644 --- a/src/bot/genkai_point/formula/v1.rs +++ b/src/bot/genkai_point/formula/v1.rs @@ -7,7 +7,7 @@ use { chrono_tz::Asia::Tokyo, }; -pub(crate) struct FormulaV1; +pub struct FormulaV1; impl GenkaiPointFormula for FormulaV1 { fn name(&self) -> &'static str { diff --git a/src/bot/genkai_point/formula/v2.rs b/src/bot/genkai_point/formula/v2.rs index 478ef0b..0145196 100644 --- a/src/bot/genkai_point/formula/v2.rs +++ b/src/bot/genkai_point/formula/v2.rs @@ -7,7 +7,7 @@ use { chrono_tz::Asia::Tokyo, }; -pub(crate) struct FormulaV2; +pub struct FormulaV2; impl GenkaiPointFormula for FormulaV2 { fn name(&self) -> &'static str { diff --git a/src/bot/genkai_point/formula/v3.rs b/src/bot/genkai_point/formula/v3.rs index 5cf1101..2c09f5e 100644 --- a/src/bot/genkai_point/formula/v3.rs +++ b/src/bot/genkai_point/formula/v3.rs @@ -4,7 +4,7 @@ use { chrono_tz::Asia::Tokyo, }; -pub(crate) struct FormulaV3; +pub struct FormulaV3; impl GenkaiPointFormula for FormulaV3 { fn name(&self) -> &'static str { diff --git a/src/bot/genkai_point/mod.rs b/src/bot/genkai_point/mod.rs index 59865ee..33b6b98 100644 --- a/src/bot/genkai_point/mod.rs +++ b/src/bot/genkai_point/mod.rs @@ -1,6 +1,6 @@ -pub(crate) mod formula; -pub(crate) mod model; -pub(crate) mod plot; +pub mod formula; +pub mod model; +pub mod plot; use { crate::bot::{ @@ -119,7 +119,7 @@ fn parse_duration(s: &str) -> Result { Ok(d) } -pub(crate) trait GenkaiPointDatabase: Send + Sync { +pub trait GenkaiPointDatabase: Send + Sync { /// Creates a new unclosed session if not exists. /// If the user's last session was closed before within 5minutes from now, clear its "left_at" field. /// If an unclosed session exists, leaves it untouched. @@ -169,18 +169,18 @@ pub(crate) trait GenkaiPointDatabase: Send + Sync { } } -pub(crate) trait Plotter: Send + Sync + 'static { +pub trait Plotter: Send + Sync + 'static { fn plot(&self, data: Vec<(String, Vec)>) -> impl Future>> + Send; } #[derive(Debug)] -pub(crate) enum CreateNewSessionResult { +pub enum CreateNewSessionResult { NewSessionCreated, UnclosedSessionExists, SessionResumed, } -pub(crate) struct GenkaiPointBot { +pub struct GenkaiPointBot { db: D, resume_msg_timeout: Mutex>, plotter: P, @@ -190,7 +190,7 @@ pub(crate) struct GenkaiPointBot { static RESUME_MSG_TIMEOUT: Lazy = Lazy::new(|| Duration::seconds(10)); impl GenkaiPointBot { - pub(crate) fn new(db: D, plotter: P) -> Self { + pub fn new(db: D, plotter: P) -> Self { Self { db, resume_msg_timeout: Mutex::new(Utc::now()), diff --git a/src/bot/genkai_point/model.rs b/src/bot/genkai_point/model.rs index e832cee..09144f6 100644 --- a/src/bot/genkai_point/model.rs +++ b/src/bot/genkai_point/model.rs @@ -7,16 +7,16 @@ use { }; #[derive(Debug, PartialEq, Eq)] -pub(crate) struct UserStat { - pub(crate) user_id: u64, - pub(crate) genkai_point: u64, - pub(crate) total_vc_duration: Duration, - pub(crate) efficiency: NotNan, - pub(crate) last_activity_at: DateTime, +pub struct UserStat { + pub user_id: u64, + pub genkai_point: u64, + pub total_vc_duration: Duration, + pub efficiency: NotNan, + pub last_activity_at: DateTime, } impl UserStat { - pub(crate) fn from_sessions( + pub fn from_sessions( sessions: &[Session], formula: &impl GenkaiPointFormula, ) -> Result> { @@ -52,18 +52,18 @@ impl UserStat { } #[derive(Debug, Clone, Serialize, Deserialize)] -pub(crate) struct Session { - pub(crate) user_id: u64, - pub(crate) joined_at: DateTime, - pub(crate) left_at: Option>, +pub struct Session { + pub user_id: u64, + pub joined_at: DateTime, + pub left_at: Option>, } impl Session { - pub(crate) fn duration(&self) -> Duration { + pub fn duration(&self) -> Duration { self.left_at.unwrap_or_else(Utc::now) - self.joined_at } - pub(crate) fn left_at(&self) -> DateTime { + pub fn left_at(&self) -> DateTime { self.left_at.unwrap_or_else(Utc::now) } } diff --git a/src/bot/genkai_point/plot/charming.rs b/src/bot/genkai_point/plot/charming.rs index df12728..903f71c 100644 --- a/src/bot/genkai_point/plot/charming.rs +++ b/src/bot/genkai_point/plot/charming.rs @@ -10,12 +10,12 @@ use { tokio::sync::oneshot, }; -pub(crate) struct Charming { +pub struct Charming { renderer: Renderer, } impl Charming { - pub(crate) fn new() -> Self { + pub fn new() -> Self { let renderer = Renderer::spawn(); Self { renderer } diff --git a/src/bot/genkai_point/plot/matplotlib.rs b/src/bot/genkai_point/plot/matplotlib.rs index 08bcebc..1777fe2 100644 --- a/src/bot/genkai_point/plot/matplotlib.rs +++ b/src/bot/genkai_point/plot/matplotlib.rs @@ -11,10 +11,10 @@ use { // FIXME: Japanese fonts rendering are broken. // FIXME: No axis description. -pub(crate) struct Matplotlib {} +pub struct Matplotlib {} impl Matplotlib { - pub(crate) fn new() -> Self { + pub fn new() -> Self { Self {} } } diff --git a/src/bot/genkai_point/plot/mod.rs b/src/bot/genkai_point/plot/mod.rs index 32ead89..1b5da94 100644 --- a/src/bot/genkai_point/plot/mod.rs +++ b/src/bot/genkai_point/plot/mod.rs @@ -10,13 +10,13 @@ use { }; #[cfg(feature = "plot_matplotlib")] -pub(crate) mod matplotlib; +pub mod matplotlib; #[cfg(feature = "plot_plotters")] -pub(crate) mod plotters; +pub mod plotters; #[cfg(feature = "plot_charming")] -pub(crate) mod charming; +pub mod charming; pub(super) async fn plot( db: &impl GenkaiPointDatabase, diff --git a/src/bot/genkai_point/plot/plotters.rs b/src/bot/genkai_point/plot/plotters.rs index 62f3c57..80831ab 100644 --- a/src/bot/genkai_point/plot/plotters.rs +++ b/src/bot/genkai_point/plot/plotters.rs @@ -7,10 +7,10 @@ use { crate::assert_one_feature!("plot_plotters_static", "plot_plotters_dynamic"); -pub(crate) struct Plotters {} +pub struct Plotters {} impl Plotters { - pub(crate) fn new() -> Self { + pub fn new() -> Self { #[cfg(feature = "plot_plotters_static")] { use parking_lot::Once; diff --git a/src/bot/mod.rs b/src/bot/mod.rs index 071bf27..dd447f0 100644 --- a/src/bot/mod.rs +++ b/src/bot/mod.rs @@ -20,7 +20,7 @@ pub mod vc_diff; // repro: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=97640973cf3459848463dbd13ba8f951 // issue: https://github.com/rust-lang/rust/issues/100013 -pub(crate) trait Message: Send + Sync { +pub trait Message: Send + Sync { type Attachment: Attachment; type User: User; @@ -30,13 +30,13 @@ pub(crate) trait Message: Send + Sync { fn attachments(&self) -> &[Self::Attachment]; } -pub(crate) trait Attachment: Send + Sync { +pub trait Attachment: Send + Sync { fn name(&self) -> &str; fn size(&self) -> usize; fn download(&self) -> impl Future>> + Send; } -pub(crate) trait User: Send + Sync { +pub trait User: Send + Sync { fn id(&self) -> u64; fn name(&self) -> &str; fn dm(&self, msg: SendMessage<'_>) -> impl Future> + Send; @@ -52,18 +52,18 @@ pub(crate) trait User: Send + Sync { } } -pub(crate) struct SendMessage<'a> { - pub(crate) content: &'a str, - pub(crate) attachments: &'a [SendAttachment<'a>], +pub struct SendMessage<'a> { + pub content: &'a str, + pub attachments: &'a [SendAttachment<'a>], } -pub(crate) struct SendAttachment<'a> { - pub(crate) name: &'a str, +pub struct SendAttachment<'a> { + pub name: &'a str, #[allow(dead_code)] - pub(crate) data: &'a [u8], + pub data: &'a [u8], } -pub(crate) trait Context: Send + Sync { +pub trait Context: Send + Sync { fn send_message(&self, msg: SendMessage<'_>) -> impl Future> + Send; fn get_user_name(&self, user_id: u64) -> impl Future> + Send; fn is_bot(&self, user_id: u64) -> impl Future> + Send; @@ -84,7 +84,7 @@ pub trait Runtime { type Context: Context; } -pub(crate) trait BotService: Send + Sync { +pub trait BotService: Send + Sync { fn name(&self) -> &'static str; fn on_message( diff --git a/src/bot/uo/mod.rs b/src/bot/uo/mod.rs index b303191..12c4111 100644 --- a/src/bot/uo/mod.rs +++ b/src/bot/uo/mod.rs @@ -22,7 +22,7 @@ enum Command { Reroll, } -pub(crate) struct UoBot { +pub struct UoBot { prob_percent: Mutex, } diff --git a/src/bot/vc_diff/mod.rs b/src/bot/vc_diff/mod.rs index 541c33c..2f54a64 100644 --- a/src/bot/vc_diff/mod.rs +++ b/src/bot/vc_diff/mod.rs @@ -30,7 +30,7 @@ enum Command { Status, } -pub(crate) struct VcDiffBot { +pub struct VcDiffBot { enabled: Mutex, timeout: Mutex>, } diff --git a/src/client/console.rs b/src/client/console.rs index 5379f62..1d91762 100644 --- a/src/client/console.rs +++ b/src/client/console.rs @@ -11,7 +11,7 @@ use { }, }; -pub(crate) struct ConsoleClient> { +pub struct ConsoleClient> { services: L, } diff --git a/src/client/discord.rs b/src/client/discord.rs index 5e8a874..80232a5 100644 --- a/src/client/discord.rs +++ b/src/client/discord.rs @@ -38,7 +38,7 @@ fn submit_signal_handler(client: &Client, waiter: impl Future + Send + 'static) }); } -pub(crate) struct DiscordClient> { +pub struct DiscordClient> { services: L, } impl DiscordClient { diff --git a/src/db/mem.rs b/src/db/mem.rs index c2126eb..b48a6a4 100644 --- a/src/db/mem.rs +++ b/src/db/mem.rs @@ -26,7 +26,7 @@ struct MemoryDBInner { meigens: Vec, } -pub(crate) struct MemoryDB(Arc>); +pub struct MemoryDB(Arc>); impl Clone for MemoryDB { fn clone(&self) -> Self { @@ -35,7 +35,7 @@ impl Clone for MemoryDB { } impl MemoryDB { - pub(crate) fn new() -> Self { + pub fn new() -> Self { Self(Arc::new(Mutex::new(MemoryDBInner { aliases: vec![], sessions: vec![], @@ -50,7 +50,7 @@ impl MemoryDB { } impl MemoryDBInner { - pub(crate) async fn dump(&self) -> Result<()> { + pub async fn dump(&self) -> Result<()> { let json = serde_json::to_string_pretty(self).context("failed to serialize")?; tokio::fs::write("mem_db_dump.json", json) diff --git a/src/db/mongodb/mod.rs b/src/db/mongodb/mod.rs index 3cd62e8..14042a4 100644 --- a/src/db/mongodb/mod.rs +++ b/src/db/mongodb/mod.rs @@ -27,12 +27,12 @@ use { }; #[derive(Clone)] -pub(crate) struct MongoDb { +pub struct MongoDb { inner: Database, } impl MongoDb { - pub(crate) async fn new(uri: &str) -> Result { + pub async fn new(uri: &str) -> Result { let opt = ClientOptions::parse(uri) .await .context("failed to parse mongodb uri")?; diff --git a/src/db/mongodb/model.rs b/src/db/mongodb/model.rs index aad2ccd..54eac49 100644 --- a/src/db/mongodb/model.rs +++ b/src/db/mongodb/model.rs @@ -16,8 +16,8 @@ pub(super) struct MongoMessageAlias { pub(super) key: String, pub(super) message: String, pub(super) attachments: Vec, - pub(crate) usage_count: i64, - pub(crate) created_at: DateTime, + pub usage_count: i64, + pub created_at: DateTime, } impl From for MongoMessageAlias { From 17704e29baf081590407a9692d85bc79cb927305 Mon Sep 17 00:00:00 2001 From: kawaemon Date: Sun, 1 Dec 2024 16:39:56 +0900 Subject: [PATCH 5/5] chore: upgrade all deps --- Cargo.lock | 966 +++++++++++++++++++++++++++++------------------------ Cargo.toml | 6 +- 2 files changed, 535 insertions(+), 437 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8358938..b1c7969 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,12 +1,12 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "ab_glyph" -version = "0.2.28" +version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79faae4620f45232f599d9bc7b290f88247a0834162c4495ab2f02d60004adfb" +checksum = "ec3672c180e71eeaaac3a541fbbc5f5ad4def8b747c595ad30d674e43049f7b0" dependencies = [ "ab_glyph_rasterizer", "owned_ttf_parser", @@ -20,9 +20,9 @@ checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" [[package]] name = "addr2line" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] @@ -84,9 +84,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.15" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -99,49 +99,49 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.4" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "arbitrary" -version = "1.3.2" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" [[package]] name = "arg_enum_proc_macro" @@ -151,7 +151,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] @@ -180,20 +180,20 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.82" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "av1-grain" @@ -211,9 +211,9 @@ dependencies = [ [[package]] name = "avif-serialize" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876c75a42f6364451a033496a14c44bffe41f5f4a8236f697391f11024e596d2" +checksum = "e335041290c43101ca215eed6f43ec437eb5a42125573f600fc3fa42b9bddd62" dependencies = [ "arrayvec", ] @@ -260,6 +260,15 @@ dependencies = [ "simd-abstraction", ] +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bindgen" version = "0.68.1" @@ -277,7 +286,30 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.77", + "syn 2.0.90", +] + +[[package]] +name = "bindgen" +version = "0.69.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" +dependencies = [ + "bitflags 2.6.0", + "cexpr", + "clang-sys", + "itertools 0.11.0", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash 1.1.0", + "shlex", + "syn 2.0.90", + "which 4.4.2", ] [[package]] @@ -315,9 +347,9 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bitstream-io" -version = "2.5.3" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b81e1519b0d82120d2fd469d5bfb2919a9361c48b02d82d04befc1cdd2002452" +checksum = "6099cdc01846bc367c4e7dd630dc5966dccf36b652fae7a74e17b640411a91b2" [[package]] name = "bitvec" @@ -351,7 +383,7 @@ dependencies = [ "bitvec", "chrono", "hex", - "indexmap 2.5.0", + "indexmap 2.7.0", "js-sys", "once_cell", "rand", @@ -376,9 +408,9 @@ dependencies = [ [[package]] name = "built" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236e6289eda5a812bc6b53c3b024039382a2895fbbeef2d748b2931546d392c4" +checksum = "c360505aed52b7ec96a3636c3f039d99103c37d1d9b4f7a8c743d3ea9ffcd03b" [[package]] name = "bumpalo" @@ -394,9 +426,9 @@ checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" [[package]] name = "bytemuck" -version = "1.18.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" +checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" [[package]] name = "byteorder" @@ -412,9 +444,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" [[package]] name = "bytes" -version = "1.7.2" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" [[package]] name = "bzip2" @@ -448,9 +480,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" dependencies = [ "serde", ] @@ -470,9 +502,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.21" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" +checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" dependencies = [ "jobserver", "libc", @@ -504,11 +536,17 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "charming" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c6b6990238a64b4ae139e7085ce2a11815cb67a0c066a3333ce40f3a329be3" +checksum = "88f802d7b8011655a1162e04e6e6849bb57baae3c0ea7026c64ba280d80d1d77" dependencies = [ "deno_core", "handlebars", @@ -568,9 +606,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.18" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" +checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" dependencies = [ "clap_builder", "clap_derive", @@ -578,9 +616,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.18" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" +checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" dependencies = [ "anstream", "anstyle", @@ -597,14 +635,14 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" [[package]] name = "color_quant" @@ -614,9 +652,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] name = "colorchoice" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "convert_case" @@ -624,6 +662,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +[[package]] +name = "cooked-waker" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147be55d677052dabc6b22252d5dd0fd4c29c8c27aa4f2fbef0f94aa003b406f" + [[package]] name = "core-foundation" version = "0.9.4" @@ -678,9 +722,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] @@ -787,7 +831,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] @@ -798,7 +842,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] @@ -839,49 +883,62 @@ dependencies = [ [[package]] name = "deno_core" -version = "0.232.0" +version = "0.311.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229ffd108e028b148a1a5a6122f771bc7c37094170226f44b8b93b3a9b79d114" +checksum = "5e09bd55da542fa1fde753aff617c355b5d782e763ab2a19e4371a56d7844cac" dependencies = [ "anyhow", + "bincode", + "bit-set", + "bit-vec", "bytes", + "cooked-waker", + "deno_core_icudata", "deno_ops", "deno_unsync", "futures", "libc", - "log", + "memoffset", "parking_lot", + "percent-encoding", "pin-project", "serde", "serde_json", "serde_v8", "smallvec", "sourcemap", + "static_assertions", "tokio", "url", "v8", ] +[[package]] +name = "deno_core_icudata" +version = "0.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13951ea98c0a4c372f162d669193b4c9d991512de9f2381dd161027f34b26b1" + [[package]] name = "deno_ops" -version = "0.108.0" +version = "0.187.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7dde627916f8539f3f0d2e754dda40810c8ca4d655f2eaac1ef54785a12fd27" +checksum = "e040fd4def8a67538fe38c9955fd970efc9f44284bd69d44f8992a456afd665d" dependencies = [ "proc-macro-rules", "proc-macro2", "quote", "strum", "strum_macros", - "syn 2.0.77", - "thiserror", + "syn 2.0.90", + "thiserror 1.0.69", ] [[package]] name = "deno_unsync" -version = "0.3.10" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c8b95582c2023dbb66fccc37421b374026f5915fa507d437cb566904db9a3a" +checksum = "2f36b4ef61a04ce201b925a5dffa90f88437d37fee4836c758470dd15ba7f05e" dependencies = [ "parking_lot", "tokio", @@ -918,7 +975,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.1", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] @@ -988,7 +1045,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] @@ -1008,9 +1065,9 @@ checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" [[package]] name = "dwrote" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da3498378ed373237bdef1eddcc64e7be2d3ba4841f4c22a998e81cadeea83c" +checksum = "70182709525a3632b2ba96b6569225467b18ecb4a77f46d255f713a6bebf05fd" dependencies = [ "lazy_static", "libc", @@ -1041,9 +1098,9 @@ dependencies = [ [[package]] name = "encoding_rs" -version = "0.8.34" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] @@ -1057,7 +1114,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] @@ -1068,12 +1125,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1087,15 +1144,14 @@ dependencies = [ [[package]] name = "exr" -version = "1.72.0" +version = "1.73.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "887d93f60543e9a9362ef8a21beedd0a833c5d9610e18c67abe15a5963dcb1a4" +checksum = "f83197f59927b46c04a183a619b7c29df34e63e63c7869320862268c0ef687e0" dependencies = [ "bit_field", - "flume", "half", "lebe", - "miniz_oxide 0.7.4", + "miniz_oxide 0.8.0", "rayon-core", "smallvec", "zune-inflate", @@ -1103,15 +1159,15 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "fdeflate" -version = "0.3.4" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645" +checksum = "07c6f4c64c1d33a3111c4466f7365ebdcc37c5bd1ea0d62aae2e3d722aacbedb" dependencies = [ "simd-adler32", ] @@ -1124,9 +1180,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", "miniz_oxide 0.8.0", @@ -1144,15 +1200,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce81f49ae8a0482e4c55ea62ebbd7e5a686af544c00b9d090bba3ff9be97b3d" -[[package]] -name = "flume" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" -dependencies = [ - "spin", -] - [[package]] name = "fnv" version = "1.0.7" @@ -1225,7 +1272,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] @@ -1256,9 +1303,9 @@ dependencies = [ [[package]] name = "fslock" -version = "0.1.8" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57eafdd0c16f57161105ae1b98a1238f97645f2f588438b2949c99a2af9616bf" +checksum = "04412b8935272e3a9bae6f48c7bfff74c2911f60525404edfdd28e49884c3bfb" dependencies = [ "libc", "winapi", @@ -1272,9 +1319,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -1287,9 +1334,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -1297,15 +1344,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -1314,38 +1361,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -1380,9 +1427,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96512db27971c2c3eece70a1e106fbe6c87760234e31e8f7e5634912fe52794a" +checksum = "2cb8bc4c28d15ade99c7e90b219f30da4be5c88e586277e8cbe886beeb868ab2" dependencies = [ "typenum", ] @@ -1422,9 +1469,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glob" @@ -1432,6 +1479,15 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "gzip-header" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95cc527b92e6029a62960ad99aa8a6660faa4555fe5f731aab13aa6a921795a2" +dependencies = [ + "crc32fast", +] + [[package]] name = "h2" version = "0.3.26" @@ -1444,7 +1500,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.5.0", + "indexmap 2.7.0", "slab", "tokio", "tokio-util", @@ -1472,7 +1528,7 @@ dependencies = [ "pest_derive", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1487,6 +1543,12 @@ version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + [[package]] name = "heck" version = "0.4.1" @@ -1499,12 +1561,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - [[package]] name = "hex" version = "0.4.3" @@ -1528,7 +1584,7 @@ dependencies = [ "ipnet", "once_cell", "rand", - "thiserror", + "thiserror 1.0.69", "tinyvec", "tokio", "tracing", @@ -1551,7 +1607,7 @@ dependencies = [ "rand", "resolv-conf", "smallvec", - "thiserror", + "thiserror 1.0.69", "tokio", "tracing", ] @@ -1643,9 +1699,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" @@ -1661,9 +1717,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.30" +version = "0.14.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" dependencies = [ "bytes", "futures-channel", @@ -1685,9 +1741,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.4.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" dependencies = [ "bytes", "futures-channel", @@ -1710,7 +1766,7 @@ checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http 0.2.12", - "hyper 0.14.30", + "hyper 0.14.31", "rustls 0.21.12", "tokio", "tokio-rustls 0.24.1", @@ -1724,32 +1780,31 @@ checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http 1.1.0", - "hyper 1.4.1", + "hyper 1.5.1", "hyper-util", - "rustls 0.23.13", + "rustls 0.23.19", "rustls-pki-types", "tokio", "tokio-rustls 0.26.0", "tower-service", - "webpki-roots 0.26.6", + "webpki-roots 0.26.7", ] [[package]] name = "hyper-util" -version = "0.1.8" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", "futures-channel", "futures-util", "http 1.1.0", "http-body 1.0.1", - "hyper 1.4.1", + "hyper 1.5.1", "pin-project-lite", "socket2", "tokio", - "tower", "tower-service", "tracing", ] @@ -1892,7 +1947,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] @@ -1913,24 +1968,23 @@ dependencies = [ [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "idna_adapter", + "smallvec", + "utf8_iter", ] [[package]] -name = "idna" -version = "1.0.2" +name = "idna_adapter" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd69211b9b519e98303c015e21a007e293db403b6c85b9b124e133d25e242cdd" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" dependencies = [ "icu_normalizer", "icu_properties", - "smallvec", - "utf8_iter", ] [[package]] @@ -1959,9 +2013,9 @@ dependencies = [ [[package]] name = "image" -version = "0.25.2" +version = "0.25.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99314c8a2152b8ddb211f924cdae532d8c5e4c8bb54728e12fff1b0cd5963a10" +checksum = "cd6f44aed642f18953a158afeb30206f4d50da59fbc66ecb53c66488de73563b" dependencies = [ "bytemuck", "byteorder-lite", @@ -1982,9 +2036,9 @@ dependencies = [ [[package]] name = "image-webp" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f79afb8cbee2ef20f59ccd477a218c12a93943d075b492015ecb1bb81f8ee904" +checksum = "e031e8e3d94711a9ccb5d6ea357439ef3dcbed361798bd4071dc4d9793fbe22f" dependencies = [ "byteorder-lite", "quick-error 2.0.1", @@ -1998,9 +2052,9 @@ checksum = "029d73f573d8e8d63e6d5020011d3255b28c3ba85d6cf870a07184ed23de9284" [[package]] name = "imgref" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44feda355f4159a7c757171a77de25daf6411e217b4cabd03bd6650690468126" +checksum = "d0263a3d970d5c054ed9312c0057b4f3bde9c0b33836d3637361d4a9e6e7a408" [[package]] name = "indexmap" @@ -2015,12 +2069,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.5.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.2", "serde", ] @@ -2054,7 +2108,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] @@ -2071,9 +2125,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.10.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "is_terminal_polyfill" @@ -2101,9 +2155,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "jobserver" @@ -2125,10 +2179,11 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -2191,29 +2246,28 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.167" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] name = "libfuzzer-sys" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a96cfd5557eb82f2b83fed4955246c988d331975a002961b07c81584d107e7f7" +checksum = "9b9569d2f74e257076d8c6bfa73fb505b46b851e51ddaecc825944aa3bed17fa" dependencies = [ "arbitrary", "cc", - "once_cell", ] [[package]] name = "libloading" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -2228,9 +2282,9 @@ dependencies = [ [[package]] name = "libwebp-sys" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20b23924c5df0186ee8743fd82a79135a609a2487b1395197c96a79be6061f1f" +checksum = "6f80c65814da7a8617fab435f2f3ebe368958f8a4bb7e26105fbbe08a285dafe" dependencies = [ "cc", "glob", @@ -2250,9 +2304,9 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "litemap" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "lock_api" @@ -2301,6 +2355,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" dependencies = [ "cfg-if", + "rayon", ] [[package]] @@ -2387,7 +2442,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", - "simd-adler32", ] [[package]] @@ -2397,15 +2451,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ "adler2", + "simd-adler32", ] [[package]] name = "mio" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ - "hermit-abi", "libc", "wasi", "windows-sys 0.52.0", @@ -2450,7 +2504,7 @@ dependencies = [ "stringprep", "strsim", "take_mut", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-rustls 0.24.1", "tokio-util", @@ -2467,7 +2521,7 @@ checksum = "3a6dbc533e93429a71c44a14c04547ac783b56d3f22e6c4f12b1b994cf93844e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] @@ -2479,7 +2533,7 @@ dependencies = [ "getrandom", "libc", "nettle-sys", - "thiserror", + "thiserror 1.0.69", "typenum", ] @@ -2489,7 +2543,7 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b495053a10a19a80e3a26bf1212e92e29350797b5f5bdc58268c3f3f818e66ec" dependencies = [ - "bindgen", + "bindgen 0.68.1", "cc", "libc", "pkg-config", @@ -2554,7 +2608,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] @@ -2588,18 +2642,18 @@ dependencies = [ [[package]] name = "object" -version = "0.36.4" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "option-ext" @@ -2609,9 +2663,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "ordered-float" -version = "4.2.2" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a91171844676f8c7990ce64959210cd2eaef32c2612c50f9fae9f8aaa6065a6" +checksum = "c65ee1f9701bf938026630b455d5315f490640234259037edb259798b3bcf85e" dependencies = [ "num-traits", ] @@ -2630,11 +2684,11 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "owned_ttf_parser" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "490d3a563d3122bf7c911a59b0add9389e5ec0f5f0c3ac6b91ff235a0e6a7f90" +checksum = "22ec719bbf3b2a81c109a4e20b1f129b5566b7dce654bc3872f6a05abf82b2c4" dependencies = [ - "ttf-parser 0.24.1", + "ttf-parser 0.25.1", ] [[package]] @@ -2716,20 +2770,20 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.13" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9" +checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" dependencies = [ "memchr", - "thiserror", + "thiserror 1.0.69", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.7.13" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d3a6e3394ec80feb3b6393c725571754c6188490265c61aaf260810d6b95aa0" +checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd" dependencies = [ "pest", "pest_generator", @@ -2737,22 +2791,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.13" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94429506bde1ca69d1b5601962c73f4172ab4726571a59ea95931218cb0e930e" +checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] name = "pest_meta" -version = "2.7.13" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac8a071862e93690b6e34e9a5fb8e33ff3734473ac0245b27232222c4906a33f" +checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d" dependencies = [ "once_cell", "pest", @@ -2766,7 +2820,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.5.0", + "indexmap 2.7.0", ] [[package]] @@ -2824,29 +2878,29 @@ checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -2896,15 +2950,15 @@ dependencies = [ [[package]] name = "png" -version = "0.17.13" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e4b0d3d1312775e782c86c91a111aa1f910cbb65e1337f9975b5f9a554b5e1" +checksum = "52f9d46a34a05a6a57566bc2bfae066ef07585a6e3fa30fbbdff5936380623f0" dependencies = [ "bitflags 1.3.2", "crc32fast", "fdeflate", "flate2", - "miniz_oxide 0.7.4", + "miniz_oxide 0.8.0", ] [[package]] @@ -2938,6 +2992,16 @@ dependencies = [ "yansi", ] +[[package]] +name = "prettyplease" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +dependencies = [ + "proc-macro2", + "syn 2.0.90", +] + [[package]] name = "proc-macro-rules" version = "0.4.0" @@ -2946,7 +3010,7 @@ checksum = "07c277e4e643ef00c1233393c673f655e3672cf7eb3ba08a00bdd0ea59139b5f" dependencies = [ "proc-macro-rules-macros", "proc-macro2", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] @@ -2958,35 +3022,35 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] [[package]] name = "profiling" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58" +checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d" dependencies = [ "profiling-procmacros", ] [[package]] name = "profiling-procmacros" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" +checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30" dependencies = [ "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] @@ -3057,45 +3121,49 @@ checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" [[package]] name = "quinn" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" +checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" dependencies = [ "bytes", "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash 2.0.0", - "rustls 0.23.13", + "rustc-hash 2.1.0", + "rustls 0.23.19", "socket2", - "thiserror", + "thiserror 2.0.3", "tokio", "tracing", ] [[package]] name = "quinn-proto" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" +checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" dependencies = [ "bytes", + "getrandom", "rand", "ring", - "rustc-hash 2.0.0", - "rustls 0.23.13", + "rustc-hash 2.1.0", + "rustls 0.23.19", + "rustls-pki-types", "slab", - "thiserror", + "thiserror 2.0.3", "tinyvec", "tracing", + "web-time", ] [[package]] name = "quinn-udp" -version = "0.5.5" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" +checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" dependencies = [ + "cfg_aliases", "libc", "once_cell", "socket2", @@ -3178,22 +3246,23 @@ dependencies = [ "rand_chacha", "simd_helpers", "system-deps", - "thiserror", + "thiserror 1.0.69", "v_frame", "wasm-bindgen", ] [[package]] name = "ravif" -version = "0.11.10" +version = "0.11.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f0bfd976333248de2078d350bfdf182ff96e168a24d23d2436cef320dd4bdd" +checksum = "2413fd96bd0ea5cdeeb37eaf446a22e6ed7b981d792828721e74ded1980a45c6" dependencies = [ "avif-serialize", "imgref", "loop9", "quick-error 2.0.1", "rav1e", + "rayon", "rgb", ] @@ -3225,9 +3294,9 @@ checksum = "3b42e27ef78c35d3998403c1d26f3efd9e135d3e5121b0a4845cc5cc27547f4f" [[package]] name = "redox_syscall" -version = "0.5.4" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags 2.6.0", ] @@ -3240,14 +3309,14 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "regex" -version = "1.10.6" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -3257,9 +3326,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -3268,9 +3337,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" @@ -3286,7 +3355,7 @@ dependencies = [ "h2", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.30", + "hyper 0.14.31", "hyper-rustls 0.24.2", "ipnet", "js-sys", @@ -3318,9 +3387,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.7" +version = "0.12.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ "base64 0.22.1", "bytes", @@ -3329,7 +3398,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.1", "http-body-util", - "hyper 1.4.1", + "hyper 1.5.1", "hyper-rustls 0.27.3", "hyper-util", "ipnet", @@ -3340,13 +3409,13 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.13", - "rustls-pemfile 2.1.3", + "rustls 0.23.19", + "rustls-pemfile 2.2.0", "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper 1.0.2", "tokio", "tokio-rustls 0.26.0", "tower-service", @@ -3354,7 +3423,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots 0.26.6", + "webpki-roots 0.26.7", "windows-registry", ] @@ -3438,9 +3507,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc-hash" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" [[package]] name = "rustc_version" @@ -3472,9 +3541,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.37" +version = "0.38.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" dependencies = [ "bitflags 2.6.0", "errno", @@ -3511,9 +3580,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.13" +version = "0.23.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" +checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ "once_cell", "ring", @@ -3534,19 +3603,21 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64 0.22.1", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +dependencies = [ + "web-time", +] [[package]] name = "rustls-webpki" @@ -3571,9 +3642,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "rusty-ponyo" @@ -3591,7 +3662,7 @@ dependencies = [ "dotenv", "hex", "humantime", - "image 0.25.2", + "image 0.25.5", "inline-python", "libwebp-sys", "mongodb", @@ -3603,7 +3674,7 @@ dependencies = [ "pretty_assertions", "rand", "regex", - "reqwest 0.12.7", + "reqwest 0.12.9", "sequoia-openpgp", "serde", "serde_json", @@ -3611,7 +3682,7 @@ dependencies = [ "sha2", "shellwords", "static_assertions", - "thiserror", + "thiserror 2.0.3", "tokio", "tokio-stream", "tracing", @@ -3714,7 +3785,7 @@ dependencies = [ "dyn-clone", "flate2", "getrandom", - "idna 1.0.2", + "idna 1.0.3", "lalrpop", "lalrpop-util", "lazy_static", @@ -3725,15 +3796,15 @@ dependencies = [ "regex", "regex-syntax", "sha1collisiondetection", - "thiserror", + "thiserror 1.0.69", "xxhash-rust", ] [[package]] name = "serde" -version = "1.0.210" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] @@ -3758,22 +3829,22 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.7.0", "itoa", "memchr", "ryu", @@ -3782,9 +3853,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -3803,30 +3874,28 @@ dependencies = [ [[package]] name = "serde_v8" -version = "0.141.0" +version = "0.220.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc689cb316d67b200e9f7449ce76cceb7e483e0f828d1a9c3d057c4367b6c26e" +checksum = "6e7a65d91d79acc82aa229aeb084f4a39bda269069bc1520df40f679495388e4" dependencies = [ - "bytes", - "derive_more", "num-bigint", "serde", "smallvec", - "thiserror", + "thiserror 1.0.69", "v8", ] [[package]] name = "serde_with" -version = "3.9.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" +checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" dependencies = [ "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.5.0", + "indexmap 2.7.0", "serde", "serde_derive", "serde_json", @@ -3836,21 +3905,21 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.9.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" +checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] name = "serenity" -version = "0.12.2" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "880a04106592d0a8f5bdacb1d935889bfbccb4a14f7074984d9cd857235d34ac" +checksum = "3d72ec4323681bf9a3cabe40fd080abc2435859b502a1b5aa9bf693f125bfa76" dependencies = [ "arrayvec", "async-trait", @@ -3908,7 +3977,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f606421e4a6012877e893c399822a4ed4b089164c5969424e1b9d1e66e6964b" dependencies = [ "digest", - "generic-array 1.1.0", + "generic-array 1.1.1", ] [[package]] @@ -4036,9 +4105,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -4046,14 +4115,16 @@ dependencies = [ [[package]] name = "sourcemap" -version = "7.1.1" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7768edd06c02535e0d50653968f46e1e0d3aa54742190d35dd9466f59de9c71" +checksum = "208d40b9e8cad9f93613778ea295ed8f3c2b1824217c6cfc7219d3f6f45b96d4" dependencies = [ "base64-simd", + "bitvec", "data-encoding", "debugid", "if_chain", + "rustc-hash 1.1.0", "rustc_version 0.2.3", "serde", "serde_json", @@ -4066,9 +4137,6 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] [[package]] name = "stable_deref_trait" @@ -4140,7 +4208,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] @@ -4172,9 +4240,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -4189,9 +4257,9 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "sync_wrapper" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" dependencies = [ "futures-core", ] @@ -4204,7 +4272,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] @@ -4267,9 +4335,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.12.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", @@ -4291,22 +4359,42 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.64" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +dependencies = [ + "thiserror-impl 2.0.3", ] [[package]] name = "thiserror-impl" -version = "1.0.64" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", ] [[package]] @@ -4423,9 +4511,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.40.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes", @@ -4447,7 +4535,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] @@ -4477,7 +4565,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.13", + "rustls 0.23.19", "rustls-pki-types", "tokio", ] @@ -4506,7 +4594,7 @@ dependencies = [ "tokio", "tokio-rustls 0.25.0", "tungstenite", - "webpki-roots 0.26.6", + "webpki-roots 0.26.7", ] [[package]] @@ -4546,38 +4634,17 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.21" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b072cee73c449a636ffd6f32bd8de3a9f7119139aff882f44943ce2986dc5cf" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.7.0", "serde", "serde_spanned", "toml_datetime", "winnow", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" - [[package]] name = "tower-service" version = "0.3.3" @@ -4586,9 +4653,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", "pin-project-lite", @@ -4598,20 +4665,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -4630,9 +4697,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "nu-ansi-term", "sharded-slab", @@ -4644,9 +4711,9 @@ dependencies = [ [[package]] name = "triomphe" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6631e42e10b40c0690bf92f404ebcfe6e1fdb480391d15f17cc8e96eeed5369" +checksum = "ef8f7726da4807b58ea5c96fdc122f80702030edc33b35aff9190a51148ccc85" [[package]] name = "try-lock" @@ -4668,9 +4735,9 @@ checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" [[package]] name = "ttf-parser" -version = "0.24.1" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be21190ff5d38e8b4a2d3b6a3ae57f612cc39c96e83cedeaf7abc338a8bac4a" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" [[package]] name = "tungstenite" @@ -4688,7 +4755,7 @@ dependencies = [ "rustls 0.22.4", "rustls-pki-types", "sha1", - "thiserror", + "thiserror 1.0.69", "url", "utf-8", ] @@ -4718,9 +4785,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "typesize" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dece5c06268af6a9ff4541788601e560a4284ffebfb357f713d676f13b964db" +checksum = "549e54551d85ba6718a95333d9bc4367f69793d7aba638de30f8d25a1f554a1d" dependencies = [ "dashmap", "hashbrown 0.14.5", @@ -4735,35 +4802,32 @@ dependencies = [ [[package]] name = "typesize-derive" -version = "0.1.7" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "905e88c2a4cc27686bd57e495121d451f027e441388a67f773be729ad4be1ea8" +checksum = "fd9fc0ad9e03a2b0c2e2a0eafaecccef2121829e1ab6ce9c9d790e6c6766bd1c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] name = "ucd-trie" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "unicase" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] +checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-bidi-mirroring" @@ -4779,15 +4843,15 @@ checksum = "cc2520efa644f8268dce4dcd3050eaa7fc044fca03961e9998ac7e2e92b77cf1" [[package]] name = "unicode-id-start" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97e2a3c5fc9de285c0e805d98eba666adb4b2d9e1049ce44821ff7707cc34e91" +checksum = "2f322b60f6b9736017344fa0635d64be2f458fbc04eef65f6be22976dd1ffd5b" [[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-normalization" @@ -4800,9 +4864,9 @@ dependencies = [ [[package]] name = "unicode-properties" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ea75f83c0137a9b98608359a5f1af8144876eb67bcb1ce837368e906a9f524" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" [[package]] name = "unicode-script" @@ -4830,12 +4894,12 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", - "idna 0.5.0", + "idna 1.0.3", "percent-encoding", "serde", ] @@ -4927,9 +4991,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" dependencies = [ "getrandom", "serde", @@ -4937,14 +5001,19 @@ dependencies = [ [[package]] name = "v8" -version = "0.81.0" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75f5f378b9b54aff3b10da8170d26af4cfd217f644cf671badcd13af5db4beb" +checksum = "a381badc47c6f15acb5fe0b5b40234162349ed9d4e4fd7c83a7f5547c0fc69c5" dependencies = [ - "bitflags 1.3.2", + "bindgen 0.69.5", + "bitflags 2.6.0", "fslock", + "gzip-header", + "home", + "miniz_oxide 0.7.4", "once_cell", - "which", + "paste", + "which 6.0.3", ] [[package]] @@ -5009,9 +5078,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" dependencies = [ "cfg-if", "once_cell", @@ -5020,36 +5089,37 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "9dfaf8f50e5f293737ee323940c7d8b08a66a95a419223d9f41610ca08b0833d" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5057,28 +5127,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" [[package]] name = "wasm-streams" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" dependencies = [ "futures-util", "js-sys", @@ -5089,9 +5159,19 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "a98bc3c33f0fe7e59ad7cd041b89034fa82a7c2d4365ca538dda6cdaf513863c" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", @@ -5105,9 +5185,9 @@ checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "webpki-roots" -version = "0.26.6" +version = "0.26.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" dependencies = [ "rustls-pki-types", ] @@ -5130,6 +5210,18 @@ dependencies = [ "rustix", ] +[[package]] +name = "which" +version = "6.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ee928febd44d98f2f459a4a79bd4d928591333a494a10a868418ac1b39cf1f" +dependencies = [ + "either", + "home", + "rustix", + "winsafe", +] + [[package]] name = "widestring" version = "1.1.0" @@ -5158,7 +5250,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] @@ -5356,9 +5448,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -5373,6 +5465,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "winsafe" +version = "0.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" + [[package]] name = "wio" version = "0.2.2" @@ -5440,9 +5538,9 @@ dependencies = [ [[package]] name = "yoke" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" dependencies = [ "serde", "stable_deref_trait", @@ -5452,13 +5550,13 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", "synstructure", ] @@ -5480,27 +5578,27 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] name = "zerofrom" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", "synstructure", ] @@ -5529,7 +5627,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.90", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 31bdb14..3f3d5a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ dotenv = "0.15" hex = "0.4" humantime = "2" image = "0.25" -libwebp-sys = "0.10" +libwebp-sys = "0.11" once_cell = "1" ordered-float = { version = "4" } parking_lot = "0.12" @@ -45,7 +45,7 @@ serde_json = "1" sha2 = "0.10" shellwords = "1" static_assertions = "1" -thiserror = "1" +thiserror = "2" tracing = "0.1" tracing-subscriber = "0.3" url = "2" @@ -65,7 +65,7 @@ crossbeam = { version = "0.8", optional = true } bzip2-sys = { version = "0.1.11", features = ["static"] } [dependencies.charming] -version = "0.3" +version = "0.4" optional = true default-features = false features = ["ssr"]