scufflecloud_core_cedar/
macros.rs1macro_rules! cedar_entity {
2 ($ty:ident) => {
3 $crate::macros::cedar_entity_id!($ty);
4
5 impl $crate::CedarEntity for $ty {}
6 };
7}
8
9pub(crate) use cedar_entity;
10
11macro_rules! cedar_entity_id {
12 ($ty:ident) => {
13 impl $crate::CedarIdentifiable for ::core_db_types::id::Id<$ty> {
14 const ENTITY_TYPE: $crate::EntityTypeName = $crate::entity_type_name!(stringify!($ty));
15
16 fn entity_id(&self) -> cedar_policy::EntityId {
17 cedar_policy::EntityId::new(self.unprefixed().to_string())
18 }
19 }
20
21 impl $crate::CedarEntityId for $ty {
22 type Id<'a> = ::core_db_types::id::Id<$ty>;
23
24 #[allow(refining_impl_trait)]
25 fn id(&self) -> &Self::Id<'_> {
26 &self.id
27 }
28 }
29 };
30}
31
32pub(crate) use cedar_entity_id;