Define public method `to_shared` for dyn Composite

This commit is contained in:
bitfl0wer 2024-01-21 17:07:54 +01:00
parent 0660e25bdb
commit 2a7cae30b8
No known key found for this signature in database
GPG Key ID: 0ACD574FCF5226CF
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 webhook::*;
use crate::gateway::Shared;
#[cfg(feature = "client")]
use crate::gateway::Updateable;
@ -121,4 +123,11 @@ pub trait Composite<T: Updateable + Clone + Debug> {
}
vec
}
fn to_shared(self) -> Shared<Self>
where
Self: Sized,
{
Arc::new(RwLock::new(self))
}
}