mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-08-01 20:53:11 +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;
|
use shared_traits::IdentIdRef;
|
||||||
|
|
||||||
pub type ConversationId = String;
|
pub type ConversationId = String;
|
||||||
|
pub type ConversationIdRef<'a> = &'a str;
|
||||||
|
|
||||||
/// Behaviour shared by every conversation kind.
|
/// Behaviour shared by every conversation kind.
|
||||||
pub(crate) trait Convo<S: ExternalServices> {
|
pub(crate) trait Convo<S: ExternalServices> {
|
||||||
@ -37,4 +38,6 @@ pub(crate) trait GroupConvo<S: ExternalServices>: Convo<S> {
|
|||||||
cx: &mut ServiceContext<S>,
|
cx: &mut ServiceContext<S>,
|
||||||
members: &[IdentIdRef],
|
members: &[IdentIdRef],
|
||||||
) -> Result<(), ChatError>;
|
) -> Result<(), ChatError>;
|
||||||
|
|
||||||
|
fn id(&self) -> ConversationIdRef<'_>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -344,4 +344,8 @@ impl<S: ExternalServices> GroupConvo<S> for GroupV1Convo {
|
|||||||
.publish(env)
|
.publish(env)
|
||||||
.map_err(|e| ChatError::Generic(format!("Publish: {e}")))
|
.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