#[non_exhaustive]pub struct Principal {
pub principal: Option<Principal>,
/* private fields */
}Available on crate features
conversational-search-service or document-service or recommendation-service or search-service only.Expand description
Principal identifier of a user or a group.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.principal: Option<Principal>Union field principal. Principal can be a user or a group.
Implementations§
Source§impl Principal
impl Principal
pub fn new() -> Self
Sourcepub fn set_principal<T: Into<Option<Principal>>>(self, v: T) -> Self
pub fn set_principal<T: Into<Option<Principal>>>(self, v: T) -> Self
Sourcepub fn user_id(&self) -> Option<&String>
pub fn user_id(&self) -> Option<&String>
The value of principal
if it holds a UserId, None if the field is not set or
holds a different branch.
Sourcepub fn set_user_id<T: Into<String>>(self, v: T) -> Self
pub fn set_user_id<T: Into<String>>(self, v: T) -> Self
Sourcepub fn group_id(&self) -> Option<&String>
pub fn group_id(&self) -> Option<&String>
The value of principal
if it holds a GroupId, None if the field is not set or
holds a different branch.
Sourcepub fn set_group_id<T: Into<String>>(self, v: T) -> Self
pub fn set_group_id<T: Into<String>>(self, v: T) -> Self
Sourcepub fn external_entity_id(&self) -> Option<&String>
pub fn external_entity_id(&self) -> Option<&String>
The value of principal
if it holds a ExternalEntityId, None if the field is not set or
holds a different branch.
Sourcepub fn set_external_entity_id<T: Into<String>>(self, v: T) -> Self
pub fn set_external_entity_id<T: Into<String>>(self, v: T) -> Self
Sets the value of principal
to hold a ExternalEntityId.
Note that all the setters affecting principal are
mutually exclusive.
§Example
ⓘ
let x = Principal::new().set_external_entity_id("example");
assert!(x.external_entity_id().is_some());
assert!(x.user_id().is_none());
assert!(x.group_id().is_none());Trait Implementations§
impl StructuralPartialEq for Principal
Auto Trait Implementations§
impl Freeze for Principal
impl RefUnwindSafe for Principal
impl Send for Principal
impl Sync for Principal
impl Unpin for Principal
impl UnwindSafe for Principal
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