Compare commits

..

No commits in common. "261fe452c16e434b0e8af3209dcf065e8f72c564" and "411db01786d6c0776c0093ce0aa638bd9e83b2ec" have entirely different histories.

6 changed files with 9 additions and 15 deletions

2
Cargo.lock generated
View File

@ -236,7 +236,7 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]] [[package]]
name = "chorus" name = "chorus"
version = "0.16.0" version = "0.15.0"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"base64 0.21.7", "base64 0.21.7",

View File

@ -1,7 +1,7 @@
[package] [package]
name = "chorus" name = "chorus"
description = "A library for interacting with multiple Spacebar-compatible Instances at once." description = "A library for interacting with multiple Spacebar-compatible Instances at once."
version = "0.16.0" version = "0.15.0"
license = "MPL-2.0" license = "MPL-2.0"
edition = "2021" edition = "2021"
repository = "https://github.com/polyphony-chat/chorus" repository = "https://github.com/polyphony-chat/chorus"

View File

@ -10,10 +10,9 @@ use std::fmt::Debug;
use super::{events::Events, *}; use super::{events::Events, *};
use crate::types::{self, Composite, Shared}; use crate::types::{self, Composite, Shared};
/// Represents a handle to a Gateway connection. /// 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
/// A Gateway connection will create observable [`Events`], which you can subscribe to. /// implemented types with the trait [`WebSocketEvent`]
///
/// Using this handle you can also send Gateway Events directly. /// Using this handle you can also send Gateway Events directly.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct GatewayHandle { pub struct GatewayHandle {

View File

@ -128,10 +128,10 @@ pub trait Composite<T: Updateable + Clone + Debug> {
pub trait IntoShared { pub trait IntoShared {
/// Uses [`Shared`] to provide an ergonomic alternative to `Arc::new(RwLock::new(obj))`. /// Uses [`Shared`] to provide an ergonomic alternative to `Arc::new(RwLock::new(obj))`.
/// ///
/// [`Shared<Self>`] can then be observed using the gateway, turning the underlying /// [`Shared<Self>`] can then be observed using the [`Gateway`], turning the underlying
/// `dyn Composite<Self>` into a self-updating struct, which is a tracked variant of a chorus /// `dyn Composite<Self>` into a self-updating struct, which is a tracked variant of a chorus
/// entity struct, updating its' held information when new information concerning itself arrives /// entity struct, updating its' held information when new information concerning itself arrives
/// over the gateway connection, reducing the need for expensive network-API calls. /// over the [`Gateway`] connection, reducing the need for expensive network-API calls.
fn into_shared(self) -> Shared<Self>; fn into_shared(self) -> Shared<Self>;
} }

View File

@ -31,7 +31,7 @@ pub struct UserModifySchema {
// TODO: Add a CDN data type // TODO: Add a CDN data type
pub avatar: Option<String>, pub avatar: Option<String>,
/// Note: This is not yet implemented on Spacebar /// Note: This is not yet implemented on Spacebar
pub avatar_decoration_id: Option<Snowflake>, pub avatar_decoration_id: Option<Snowflake>,
/// Note: This is not yet implemented on Spacebar /// Note: This is not yet implemented on Spacebar
pub avatar_decoration_sku_id: Option<Snowflake>, pub avatar_decoration_sku_id: Option<Snowflake>,
/// The user's email address; if changing from a verified email, email_token must be provided /// The user's email address; if changing from a verified email, email_token must be provided
@ -70,11 +70,6 @@ pub struct UserModifySchema {
/// # Note /// # Note
/// ///
/// This is not yet implemented on Spacebar /// This is not yet implemented on Spacebar
///
/// [UserFlags]: crate::types::UserFlags
/// [UserFlags::PREMIUM_PROMO_DISMISSED]: crate::types::UserFlags::PREMIUM_PROMO_DISMISSED
/// [UserFlags::HAS_UNREAD_URGENT_MESSAGES]:
/// crate::types::UserFlags::HAS_UNREAD_URGENT_MESSAGES
pub flags: Option<u64>, pub flags: Option<u64>,
/// The user's date of birth, can only be set once /// The user's date of birth, can only be set once
/// ///

View File

@ -26,7 +26,7 @@ impl Snowflake {
const PROCESS_ID: u64 = 1; const PROCESS_ID: u64 = 1;
static INCREMENT: AtomicUsize = AtomicUsize::new(0); static INCREMENT: AtomicUsize = AtomicUsize::new(0);
let time = (Utc::now().naive_utc().and_utc().timestamp_millis() - EPOCH) << 22; let time = (Utc::now().naive_utc().timestamp_millis() - EPOCH) << 22;
let worker = WORKER_ID << 17; let worker = WORKER_ID << 17;
let process = PROCESS_ID << 12; let process = PROCESS_ID << 12;
let increment = INCREMENT.fetch_add(1, Ordering::Relaxed) as u64 % 32; let increment = INCREMENT.fetch_add(1, Ordering::Relaxed) as u64 % 32;