pub struct ResolvedPrincipal {
pub id: Principal,
pub display_name: Option<String>,
}Expand description
A Principal paired with an optional human-readable display name.
Principal stores only an opaque UUID — never PII. When a presentation
layer (API response, audit log UI) needs to show a user-friendly name, an
identity service resolves the UUID at read time and wraps it here.
The display name is never persisted; only the opaque id is stored.
§Examples
use api_bones::{Principal, ResolvedPrincipal};
use uuid::Uuid;
let id = Principal::human(Uuid::nil());
let r = ResolvedPrincipal::new(id, Some("Alice Martin".to_owned()));
assert_eq!(r.display(), "Alice Martin");
let anonymous = ResolvedPrincipal::new(Principal::human(Uuid::nil()), None);
assert_eq!(anonymous.display(), anonymous.id.as_str());Fields§
§id: PrincipalThe opaque, stored identity.
display_name: Option<String>Human-readable display name resolved from the identity service.
None when the resolution has not been performed or the actor is
a system principal with no display name.
Implementations§
Trait Implementations§
Source§impl Clone for ResolvedPrincipal
impl Clone for ResolvedPrincipal
Source§fn clone(&self) -> ResolvedPrincipal
fn clone(&self) -> ResolvedPrincipal
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResolvedPrincipal
impl Debug for ResolvedPrincipal
Source§impl<'de> Deserialize<'de> for ResolvedPrincipal
impl<'de> Deserialize<'de> for ResolvedPrincipal
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Principal> for ResolvedPrincipal
impl From<Principal> for ResolvedPrincipal
Source§impl PartialEq for ResolvedPrincipal
impl PartialEq for ResolvedPrincipal
Source§impl Serialize for ResolvedPrincipal
impl Serialize for ResolvedPrincipal
impl Eq for ResolvedPrincipal
impl StructuralPartialEq for ResolvedPrincipal
Auto Trait Implementations§
impl Freeze for ResolvedPrincipal
impl RefUnwindSafe for ResolvedPrincipal
impl Send for ResolvedPrincipal
impl Sync for ResolvedPrincipal
impl Unpin for ResolvedPrincipal
impl UnsafeUnpin for ResolvedPrincipal
impl UnwindSafe for ResolvedPrincipal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more