reactive_graph_client/schema_graphql/scalar/
id.rs

1use std::fmt::Display;
2use std::fmt::Formatter;
3use uuid::Uuid;
4
5#[derive(cynic::Scalar, Debug, Clone)]
6#[cynic(schema_module = "crate::schema_graphql::schema", graphql_type = "UUID")]
7pub struct UUID(pub Uuid);
8
9impl From<Uuid> for UUID {
10    fn from(id: Uuid) -> Self {
11        UUID(id)
12    }
13}
14
15impl From<UUID> for Uuid {
16    fn from(id: UUID) -> Self {
17        id.0
18    }
19}
20
21impl Display for UUID {
22    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
23        write!(f, "{}", self.0)
24    }
25}