pub struct Unique<S> { /* private fields */ }Expand description
How a unique key is unique, for crate::Aggregate::unique: within the command’s tenant
(Unique::tenant, also Unique::default()) or across tenants (Unique::global), and
optionally personal: Unique::global().personal(|s: &Customer| Some(s.id.clone())).
Implementations§
Source§impl<S> Unique<S>
impl<S> Unique<S>
Sourcepub fn tenant() -> Self
pub fn tenant() -> Self
Unique within the command’s tenant: another tenant may hold the same value.
Sourcepub fn global() -> Self
pub fn global() -> Self
Unique across tenants. The key’s identity has no tenant, so a command that is rejected
with unique_taken learns that some tenant holds the value.
Sourcepub fn personal(
self,
subject: impl Fn(&S) -> Option<String> + Send + Sync + 'static,
) -> Self
pub fn personal( self, subject: impl Fn(&S) -> Option<String> + Send + Sync + 'static, ) -> Self
Makes the value personal data of the subject subject returns from the state: the
kernel keeps the key in its vault, and erasing the subject frees it. None or an empty
subject: the aggregate holds no value of this key.
Trait Implementations§
Auto Trait Implementations§
impl<S> !RefUnwindSafe for Unique<S>
impl<S> !UnwindSafe for Unique<S>
impl<S> Forget for Unique<S>
impl<S> Freeze for Unique<S>
impl<S> Move for Unique<S>
impl<S> Send for Unique<S>
impl<S> Sync for Unique<S>
impl<S> Unpin for Unique<S>
impl<S> UnsafeUnpin for Unique<S>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request