pub struct ProtoSerializer;Implementations§
Source§impl ProtoSerializer
impl ProtoSerializer
pub fn new() -> Self
Sourcepub fn serialize_event(&self, event: &Event) -> Result<Vec<u8>>
pub fn serialize_event(&self, event: &Event) -> Result<Vec<u8>>
Serialize an event to Protocol Buffers format
Sourcepub fn deserialize_event(&self, data: &[u8]) -> Result<Event>
pub fn deserialize_event(&self, data: &[u8]) -> Result<Event>
Deserialize an event from Protocol Buffers format
Sourcepub fn serialize_snapshot(
&self,
snapshot: &AggregateSnapshot,
) -> Result<Vec<u8>>
pub fn serialize_snapshot( &self, snapshot: &AggregateSnapshot, ) -> Result<Vec<u8>>
Serialize an aggregate snapshot to Protocol Buffers format
Sourcepub fn deserialize_snapshot(&self, data: &[u8]) -> Result<AggregateSnapshot>
pub fn deserialize_snapshot(&self, data: &[u8]) -> Result<AggregateSnapshot>
Deserialize an aggregate snapshot from Protocol Buffers format
Source§impl ProtoSerializer
impl ProtoSerializer
Sourcepub fn create_user_registered(name: String, email: String) -> UserRegistered
pub fn create_user_registered(name: String, email: String) -> UserRegistered
Create a UserRegistered event
Sourcepub fn create_user_email_changed(
old_email: String,
new_email: String,
) -> UserEmailChanged
pub fn create_user_email_changed( old_email: String, new_email: String, ) -> UserEmailChanged
Create a UserEmailChanged event
Sourcepub fn create_user_deactivated(reason: String) -> UserDeactivated
pub fn create_user_deactivated(reason: String) -> UserDeactivated
Create a UserDeactivated event
Sourcepub fn create_order_placed(
customer_id: String,
items: Vec<OrderItem>,
total_amount: f64,
) -> OrderPlaced
pub fn create_order_placed( customer_id: String, items: Vec<OrderItem>, total_amount: f64, ) -> OrderPlaced
Create an OrderPlaced event
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ProtoSerializer
impl RefUnwindSafe for ProtoSerializer
impl Send for ProtoSerializer
impl Sync for ProtoSerializer
impl Unpin for ProtoSerializer
impl UnwindSafe for ProtoSerializer
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more