Replace Arc, Rwlock with Shared
This commit is contained in:
parent
196a36a5fe
commit
b5923c30e2
|
@ -1,10 +1,8 @@
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use std::sync::{Arc, RwLock};
|
|
||||||
|
|
||||||
use chorus::errors::GatewayError;
|
use chorus::errors::GatewayError;
|
||||||
use chorus::gateway::*;
|
use chorus::gateway::*;
|
||||||
use chorus::types::{self, ChannelModifySchema, RoleCreateModifySchema, RoleObject};
|
use chorus::types::{self, ChannelModifySchema, Composite, RoleCreateModifySchema, RoleObject};
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
use wasm_bindgen_test::*;
|
use wasm_bindgen_test::*;
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
@ -97,11 +95,7 @@ async fn test_recursive_self_updating_structs() {
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
// Watch role;
|
// Watch role;
|
||||||
bundle
|
bundle.user.gateway.observe(role.into_shared()).await;
|
||||||
.user
|
|
||||||
.gateway
|
|
||||||
.observe(Arc::new(RwLock::new(role.clone())))
|
|
||||||
.await;
|
|
||||||
// Update Guild and check for Guild
|
// Update Guild and check for Guild
|
||||||
let inner_guild = guild.read().unwrap().clone();
|
let inner_guild = guild.read().unwrap().clone();
|
||||||
assert!(inner_guild.roles.is_some());
|
assert!(inner_guild.roles.is_some());
|
||||||
|
@ -113,7 +107,7 @@ async fn test_recursive_self_updating_structs() {
|
||||||
let role_inner = bundle
|
let role_inner = bundle
|
||||||
.user
|
.user
|
||||||
.gateway
|
.gateway
|
||||||
.observe_and_into_inner(Arc::new(RwLock::new(role.clone())))
|
.observe_and_into_inner(role.into_shared())
|
||||||
.await;
|
.await;
|
||||||
assert_eq!(role_inner.name, "yippieee");
|
assert_eq!(role_inner.name, "yippieee");
|
||||||
// Check if the change propagated
|
// Check if the change propagated
|
||||||
|
|
Loading…
Reference in New Issue