mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-06-30 21:20:09 +00:00
Move Id to trait
This commit is contained in:
parent
00776d2b9a
commit
14e616f0bb
@ -10,6 +10,7 @@ pub use privatev1::PrivateV1Convo;
|
||||
use shared_traits::IdentIdRef;
|
||||
|
||||
pub type ConversationId = String;
|
||||
pub type ConversationIdRef<'a> = &'a str;
|
||||
|
||||
/// Behaviour shared by every conversation kind.
|
||||
pub(crate) trait Convo<S: ExternalServices> {
|
||||
@ -37,4 +38,6 @@ pub(crate) trait GroupConvo<S: ExternalServices>: Convo<S> {
|
||||
cx: &mut ServiceContext<S>,
|
||||
members: &[IdentIdRef],
|
||||
) -> Result<(), ChatError>;
|
||||
|
||||
fn id(&self) -> ConversationIdRef<'_>;
|
||||
}
|
||||
|
||||
@ -344,4 +344,8 @@ impl<S: ExternalServices> GroupConvo<S> for GroupV1Convo {
|
||||
.publish(env)
|
||||
.map_err(|e| ChatError::Generic(format!("Publish: {e}")))
|
||||
}
|
||||
|
||||
fn id(&self) -> super::ConversationIdRef<'_> {
|
||||
&self.convo_id
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user