Skip to main content

AggregateSnapshot

Struct AggregateSnapshot 

Source
pub struct AggregateSnapshot<S> { /* private fields */ }
Expand description

English:
Owned aggregate state paired with the last event revision it represents. No identifier or schema version is added; include validation metadata in S when needed.

日本語:
集約状態と、その状態が反映する最後のイベントのリビジョンを所有します。 識別子やスキーマバージョンは追加しません。検証用メタデータは必要に応じて S に含めます。

§Example / 使用例

use ddd_toolkit_core::{AggregateSnapshot, StreamRevision};
let snapshot = AggregateSnapshot::new(42_u64, StreamRevision::new(3));
assert_eq!(*snapshot.state(), 42);
assert_eq!(snapshot.into_parts(), (42, StreamRevision::new(3)));

Implementations§

Source§

impl<S> AggregateSnapshot<S>

Source

pub fn new(state: S, revision: StreamRevision) -> AggregateSnapshot<S>

English:
Pairs state with revision without checking consistency or compatibility.

日本語:
整合性や互換性を検証せず、state と revision を組み合わせます。

Source

pub fn state(&self) -> &S

English:
Borrows the stored aggregate state.

日本語:
保存された集約状態を借用します。

Source

pub fn revision(&self) -> StreamRevision

English:
Returns the last event revision represented by the state.

日本語:
状態が反映する最後のイベントのリビジョンを返します。

Source

pub fn into_parts(self) -> (S, StreamRevision)

English:
Consumes the snapshot, returning state and revision without cloning.

日本語:
スナップショットを消費し、複製せずに状態とリビジョンを返します。

Trait Implementations§

Source§

impl<S> Debug for AggregateSnapshot<S>
where S: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<S> Eq for AggregateSnapshot<S>
where S: Eq,

Source§

impl<S> PartialEq for AggregateSnapshot<S>
where S: PartialEq,

Source§

fn eq(&self, other: &AggregateSnapshot<S>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<S> StructuralPartialEq for AggregateSnapshot<S>
where S: PartialEq,

Auto Trait Implementations§

§

impl<S> Freeze for AggregateSnapshot<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for AggregateSnapshot<S>
where S: RefUnwindSafe,

§

impl<S> Send for AggregateSnapshot<S>
where S: Send,

§

impl<S> Sync for AggregateSnapshot<S>
where S: Sync,

§

impl<S> Unpin for AggregateSnapshot<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for AggregateSnapshot<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for AggregateSnapshot<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.