openfga_client/
display.rs1use crate::client::{ReadRequestTupleKey, RelationshipCondition, TupleKey};
2
3impl std::fmt::Display for TupleKey {
4 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5 if let Some(condition) = &self.condition {
6 write!(
7 f,
8 "({}, {}, {}) with condition {}",
9 self.user, self.relation, self.object, condition
10 )
11 } else {
12 write!(f, "({}, {}, {})", self.user, self.relation, self.object)
13 }
14 }
15}
16
17impl std::fmt::Display for RelationshipCondition {
18 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19 write!(f, "{}", self.name)
20 }
21}
22
23impl std::fmt::Display for ReadRequestTupleKey {
24 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25 write!(f, "({}, {}, {})", self.user, self.relation, self.object)
26 }
27}