Define public method `to_shared` for dyn Composite

This commit is contained in:
bitfl0wer 2024-01-21 17:07:54 +01:00
parent 48fddb7378
commit 22e8ca2a97
1 changed files with 9 additions and 0 deletions

View File

@ -23,6 +23,8 @@ pub use user_settings::*;
pub use voice_state::*; pub use voice_state::*;
pub use webhook::*; pub use webhook::*;
use crate::gateway::Shared;
#[cfg(feature = "client")] #[cfg(feature = "client")]
use crate::gateway::Updateable; use crate::gateway::Updateable;
@ -121,4 +123,11 @@ pub trait Composite<T: Updateable + Clone + Debug> {
} }
vec vec
} }
fn to_shared(self) -> Shared<Self>
where
Self: Sized,
{
Arc::new(RwLock::new(self))
}
} }