refactor(domain): delegate OrgId Display, rename to_uuid, mark new must_use

This commit is contained in:
2026-06-02 00:44:49 +02:00
parent 8ae9de12c0
commit b9b99c0332
+4 -3
View File
@@ -13,6 +13,7 @@ pub struct OrgId(Uuid);
impl OrgId {
/// Generate a fresh random id.
#[must_use = "generating an OrgId and discarding it is almost certainly a mistake"]
pub fn new() -> Self {
Self(Uuid::new_v4())
}
@@ -22,8 +23,8 @@ impl OrgId {
Self(uuid)
}
/// The underlying [`Uuid`].
pub fn as_uuid(&self) -> Uuid {
/// Return the underlying [`Uuid`].
pub fn to_uuid(&self) -> Uuid {
self.0
}
}
@@ -36,7 +37,7 @@ impl Default for OrgId {
impl fmt::Display for OrgId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
fmt::Display::fmt(&self.0, f)
}
}