Move Shared<T> to types/mod.rs, bump some dependencies (#492)
* deps: bump rustls to 0.21.11 This is done to fix CVE-2024-32650, which practically shouldn't affect us but it's still better not to use vulnerable dependencies. * deps: bump h2 to 0.3.26 This is done to fix another vulnerability, which should also not affect us (non-critical, in h2 servers) * fix: move Shared<T> to types/mod.rs
This commit is contained in:
parent
319748c0a7
commit
b2fd3e18cc
|
@ -716,9 +716,9 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
|
|||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.3.24"
|
||||
version = "0.3.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9"
|
||||
checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
|
@ -1753,9 +1753,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.21.10"
|
||||
version = "0.21.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba"
|
||||
checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ring 0.17.7",
|
||||
|
|
|
@ -8,7 +8,7 @@ use log::*;
|
|||
use std::fmt::Debug;
|
||||
|
||||
use super::{events::Events, *};
|
||||
use crate::types::{self, Composite};
|
||||
use crate::types::{self, Composite, Shared};
|
||||
|
||||
/// Represents a handle to a Gateway connection. A Gateway connection will create observable
|
||||
/// [`GatewayEvents`](GatewayEvent), which you can subscribe to. Gateway events include all currently
|
||||
|
|
|
@ -133,10 +133,3 @@ impl<T: WebSocketEvent> GatewayEvent<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// A type alias for [`Arc<RwLock<T>>`], used to make the public facing API concerned with
|
||||
/// Composite structs more ergonomic.
|
||||
/// ## Note
|
||||
///
|
||||
/// While `T` does not have to implement `Composite` to be used with `Shared`,
|
||||
/// the primary use of `Shared` is with types that implement `Composite`.
|
||||
pub type Shared<T> = Arc<RwLock<T>>;
|
||||
|
|
|
@ -13,11 +13,11 @@ use reqwest::Client;
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::errors::ChorusResult;
|
||||
use crate::gateway::{Gateway, GatewayHandle, Shared};
|
||||
use crate::gateway::{Gateway, GatewayHandle};
|
||||
use crate::ratelimiter::ChorusRequest;
|
||||
use crate::types::types::subconfigs::limits::rates::RateLimits;
|
||||
use crate::types::{
|
||||
GeneralConfiguration, Limit, LimitType, LimitsConfiguration, User, UserSettings,
|
||||
GeneralConfiguration, Limit, LimitType, LimitsConfiguration, Shared, User, UserSettings,
|
||||
};
|
||||
use crate::UrlBundle;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
|
|||
use serde_json::Value;
|
||||
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::Shared;
|
||||
use crate::types::utils::Snowflake;
|
||||
use crate::types::{Team, User};
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::Shared;
|
||||
use crate::types::utils::Snowflake;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::Shared;
|
||||
#[cfg(feature = "client")]
|
||||
use crate::gateway::Updateable;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use serde_aux::prelude::deserialize_string_from_number;
|
|||
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||
use std::fmt::Debug;
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::Shared;
|
||||
use crate::types::{
|
||||
entities::{GuildMember, User},
|
||||
utils::Snowflake,
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::fmt::Debug;
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::Shared;
|
||||
use crate::types::entities::User;
|
||||
use crate::types::Snowflake;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use chrono::{DateTime, Utc};
|
|||
use serde::{Deserialize, Serialize};
|
||||
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::Shared;
|
||||
use crate::types::types::guild_configuration::GuildFeaturesList;
|
||||
use crate::types::{
|
||||
entities::{Channel, Emoji, RoleObject, Sticker, User, VoiceState, Webhook},
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::Shared;
|
||||
use crate::types::{entities::PublicUser, Snowflake};
|
||||
|
||||
#[derive(Debug, Deserialize, Default, Serialize, Clone)]
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::{
|
||||
Shared,
|
||||
entities::{Application, User},
|
||||
utils::Snowflake,
|
||||
};
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::{Snowflake, WelcomeScreenObject};
|
||||
use crate::types::{Snowflake, WelcomeScreenObject, Shared};
|
||||
|
||||
use super::guild::GuildScheduledEvent;
|
||||
use super::{Application, Channel, GuildMember, NSFWLevel, User};
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::{
|
||||
Shared,
|
||||
entities::{
|
||||
Application, Attachment, Channel, Emoji, GuildMember, PublicUser, RoleSubscriptionData,
|
||||
Sticker, StickerItem, User,
|
||||
|
|
|
@ -27,7 +27,9 @@ pub use user_settings::*;
|
|||
pub use voice_state::*;
|
||||
pub use webhook::*;
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::Shared;
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
use crate::gateway::Updateable;
|
||||
|
||||
|
@ -39,8 +41,6 @@ use async_trait::async_trait;
|
|||
|
||||
#[cfg(feature = "client")]
|
||||
use std::fmt::Debug;
|
||||
#[cfg(feature = "client")]
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
mod application;
|
||||
mod attachment;
|
||||
|
|
|
@ -6,8 +6,7 @@ use chrono::{DateTime, Utc};
|
|||
use serde::{Deserialize, Serialize};
|
||||
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::Snowflake;
|
||||
use crate::types::{Shared, Snowflake};
|
||||
|
||||
use super::PublicUser;
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::{entities::User, utils::Snowflake};
|
||||
use crate::types::{entities::User, utils::Snowflake, Shared};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::entities::User;
|
||||
use crate::types::Snowflake;
|
||||
use crate::types::Shared;
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::{
|
||||
Shared,
|
||||
entities::{Guild, User},
|
||||
utils::Snowflake,
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::sync::{Arc, RwLock};
|
|||
use chrono::{serde::ts_milliseconds_option, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::Shared;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
#[cfg(feature = "client")]
|
||||
use chorus_macros::Composite;
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::Shared;
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
use crate::types::Composite;
|
||||
|
||||
|
@ -51,6 +52,7 @@ pub struct VoiceState {
|
|||
pub id: Option<Snowflake>, // Only exists on Spacebar
|
||||
}
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
impl Updateable for VoiceState {
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
fn id(&self) -> Snowflake {
|
||||
|
|
|
@ -6,7 +6,8 @@ use std::fmt::Debug;
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::Shared;
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
use crate::gateway::Updateable;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use crate::types::events::WebSocketEvent;
|
||||
use crate::types::IntoShared;
|
||||
use crate::types::{entities::Channel, JsonField, Snowflake, SourceUrlField};
|
||||
use chorus_macros::{JsonField, SourceUrlField};
|
||||
use chrono::{DateTime, Utc};
|
||||
|
@ -13,7 +12,10 @@ use serde::{Deserialize, Serialize};
|
|||
use super::UpdateMessage;
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::Shared;
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
use crate::types::IntoShared;
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
use crate::types::Guild;
|
||||
|
|
|
@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
|
|||
use crate::types::entities::{Guild, PublicUser, UnavailableGuild};
|
||||
use crate::types::events::WebSocketEvent;
|
||||
use crate::types::{
|
||||
AuditLogEntry, Emoji, GuildMember, GuildScheduledEvent, IntoShared, JsonField, RoleObject,
|
||||
AuditLogEntry, Emoji, GuildMember, GuildScheduledEvent, JsonField, RoleObject,
|
||||
Snowflake, SourceUrlField, Sticker,
|
||||
};
|
||||
|
||||
|
@ -18,7 +18,9 @@ use super::PresenceUpdate;
|
|||
#[cfg(feature = "client")]
|
||||
use super::UpdateMessage;
|
||||
#[cfg(feature = "client")]
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::Shared;
|
||||
#[cfg(feature = "client")]
|
||||
use crate::types::IntoShared;
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, SourceUrlField, JsonField, WebSocketEvent)]
|
||||
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-create>;
|
||||
|
|
|
@ -48,7 +48,7 @@ use serde_json::{from_str, from_value, to_value, Value};
|
|||
use std::collections::HashMap;
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
use crate::gateway::Shared;
|
||||
use crate::types::Shared;
|
||||
use std::fmt::Debug;
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
//! All the types, entities, events and interfaces of the Spacebar API.
|
||||
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
pub use config::*;
|
||||
pub use entities::*;
|
||||
pub use errors::*;
|
||||
|
@ -19,3 +21,11 @@ mod events;
|
|||
mod interfaces;
|
||||
mod schema;
|
||||
mod utils;
|
||||
|
||||
/// A type alias for [`Arc<RwLock<T>>`], used to make the public facing API concerned with
|
||||
/// Composite structs more ergonomic.
|
||||
/// ## Note
|
||||
///
|
||||
/// While `T` does not have to implement `Composite` to be used with `Shared`,
|
||||
/// the primary use of `Shared` is with types that implement `Composite`.
|
||||
pub type Shared<T> = Arc<RwLock<T>>;
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use chorus::gateway::{Gateway, Shared};
|
||||
use chorus::gateway::Gateway;
|
||||
use chorus::types::IntoShared;
|
||||
use chorus::{
|
||||
instance::{ChorusUser, Instance},
|
||||
types::{
|
||||
Channel, ChannelCreateSchema, Guild, GuildCreateSchema, RegisterSchema,
|
||||
RoleCreateModifySchema, RoleObject,
|
||||
RoleCreateModifySchema, RoleObject, Shared
|
||||
},
|
||||
UrlBundle,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue