diff options
Diffstat (limited to 'src/conversation')
| -rw-r--r-- | src/conversation/id.rs | 40 |
1 files changed, 6 insertions, 34 deletions
diff --git a/src/conversation/id.rs b/src/conversation/id.rs index 5f37a59..1c260c2 100644 --- a/src/conversation/id.rs +++ b/src/conversation/id.rs @@ -1,38 +1,10 @@ -use std::fmt; +pub type Id = crate::id::Id<Conversation>; -use crate::id::Id as BaseId; +#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub struct Conversation; -// Stable identifier for a [Conversation]. Prefixed with `C`. -#[derive( - Clone, - Debug, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - sqlx::Type, - serde::Deserialize, - serde::Serialize, -)] -#[sqlx(transparent)] -#[serde(transparent)] -pub struct Id(BaseId); - -impl From<BaseId> for Id { - fn from(id: BaseId) -> Self { - Self(id) - } -} - -impl Id { - pub fn generate() -> Self { - BaseId::generate("C") - } -} - -impl fmt::Display for Id { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - self.0.fmt(f) +impl crate::id::Prefix for Conversation { + fn prefix(&self) -> &'static str { + "C" } } |
