File tree Expand file tree Collapse file tree 13 files changed +3373
-61
lines changed Expand file tree Collapse file tree 13 files changed +3373
-61
lines changed Original file line number Diff line number Diff line change 1+ allowed-duplicate-crates = [
2+ " syn" ,
3+ # These are all coming from eventually-postgres, quite likely sqlx...
4+ " hashbrown" ,
5+ " wasi" ,
6+ " windows-sys" ,
7+ " windows-targets" ,
8+ " windows_aarch64_gnullvm" ,
9+ " windows_aarch64_msvc" ,
10+ " windows_i686_gnu" ,
11+ " windows_i686_msvc" ,
12+ " windows_x86_64_gnu" ,
13+ " windows_x86_64_gnullvm" ,
14+ " windows_x86_64_msvc" ,
15+ " zerocopy" ,
16+ " zerocopy-derive" ,
17+ " getrandom" ,
18+ ]
Original file line number Diff line number Diff line change 11** /target
22** /* .rs.bk
3- Cargo.lock
3+ / Cargo.lock
44lcov.info
5-
65.direnv
Original file line number Diff line number Diff line change 11{
22 "rust-analyzer.cargo.features" : " all" ,
3- "rust-analyzer.check.command" : " clippy"
3+ "rust-analyzer.check.command" : " clippy" ,
4+ "nix.serverPath" : " nil" ,
5+ "nix.enableLanguageServer" : true ,
6+ "nix.serverSettings" : {
7+ "nil" : {
8+ "formatting" : {
9+ "command" : [" nixpkgs-fmt" ]
10+ }
11+ }
12+ },
413}
Original file line number Diff line number Diff line change 11[workspace ]
22resolver = " 2"
3- members = [
4- " eventually" ,
5- " eventually-macros" ,
6- " eventually-postgres" ,
7-
8- # Crates as examples
9- " examples/bank-accounting" ,
10- ]
3+ members = [" eventually" , " eventually-macros" , " eventually-postgres" ]
4+ exclude = [" examples/bank-accounting" ]
Original file line number Diff line number Diff line change @@ -13,15 +13,15 @@ pub mod event;
1313
1414pub ( crate ) static MIGRATIONS : sqlx:: migrate:: Migrator = sqlx:: migrate!( "./migrations" ) ;
1515
16+ use std:: sync:: LazyLock ;
17+
1618use eventually:: version:: { ConflictError , Version } ;
17- use lazy_static:: lazy_static;
1819use regex:: Regex ;
1920
20- lazy_static ! {
21- static ref CONFLICT_ERROR_REGEX : Regex =
22- Regex :: new( r"version check failed, expected: (?P<expected>\d), got: (?P<got>\d)" )
23- . expect( "regex compiles successfully" ) ;
24- }
21+ static CONFLICT_ERROR_REGEX : LazyLock < Regex > = LazyLock :: new ( || {
22+ Regex :: new ( r"version check failed, expected: (?P<expected>\d), got: (?P<got>\d)" )
23+ . expect ( "regex compiles successfully" )
24+ } ) ;
2525
2626pub ( crate ) fn check_for_conflict_error ( err : & sqlx:: Error ) -> Option < ConflictError > {
2727 fn capture_to_version ( captures : & regex:: Captures , name : & ' static str ) -> Version {
Original file line number Diff line number Diff line change @@ -246,15 +246,15 @@ where
246246#[ derive( Debug , thiserror:: Error ) ]
247247pub enum RehydrateError < T , I > {
248248 /// Error returned during rehydration when the [Aggregate Root][Root]
249- /// is applying a Domain Event using [Aggregate::apply].
249+ /// is applying a Domain Event using [` Aggregate::apply` ].
250250 ///
251251 /// This usually implies the Event Stream for the [Aggregate]
252252 /// contains corrupted or unexpected data.
253253 #[ error( "failed to apply domain event while rehydrating aggregate: {0}" ) ]
254254 Domain ( #[ source] T ) ,
255255
256- /// This error is returned by [Root::rehydrate_async] when the underlying
257- /// [futures::TryStream] has returned an error.
256+ /// This error is returned by [` Root::rehydrate_async` ] when the underlying
257+ /// [` futures::TryStream` ] has returned an error.
258258 #[ error( "failed to rehydrate aggregate from event stream: {0}" ) ]
259259 Inner ( #[ source] I ) ,
260260}
@@ -556,7 +556,7 @@ mod tests {
556556 {
557557 assert ! ( error
558558 . source( )
559- . map_or ( false , |src| src. is:: <version:: ConflictError >( ) ) ) ;
559+ . is_some_and ( |src| src. is:: <version:: ConflictError >( ) ) ) ;
560560 }
561561 }
562562}
Original file line number Diff line number Diff line change 3939/// All possible errors returned by [`Saver::save`].
4040#[ derive( Debug , thiserror:: Error ) ]
4141pub enum SaveError {
42- /// Error returned when [Saver::save] encounters a conflict error while saving the new Aggregate Root.
42+ /// Error returned when [` Saver::save` ] encounters a conflict error while saving the new Aggregate Root.
4343 #[ error( "failed to save aggregate root: {0}" ) ]
4444 Conflict ( #[ from] version:: ConflictError ) ,
4545 /// Error returned when the [Saver] implementation has encountered an error.
Original file line number Diff line number Diff line change @@ -163,6 +163,6 @@ where
163163 assert_eq ! ( events, recorded_events) ;
164164 } ,
165165 ScenarioThenCase :: Fails => assert ! ( result. is_err( ) ) ,
166- } ;
166+ }
167167 }
168168}
Original file line number Diff line number Diff line change 3333/// All possible error types returned by [`Appender::append`].
3434#[ derive( Debug , thiserror:: Error ) ]
3535pub enum AppendError {
36- /// Error returned when [Appender::append] encounters a conflict error
36+ /// Error returned when [` Appender::append` ] encounters a conflict error
3737 /// while appending the new Domain Events.
3838 #[ error( "failed to append new domain events: {0}" ) ]
3939 Conflict ( #[ from] version:: ConflictError ) ,
@@ -343,8 +343,9 @@ where
343343#[ allow( clippy:: semicolon_if_nothing_returned) ] // False positives :shrugs:
344344#[ cfg( test) ]
345345mod test {
346+ use std:: sync:: LazyLock ;
347+
346348 use futures:: TryStreamExt ;
347- use lazy_static:: lazy_static;
348349
349350 use super :: * ;
350351 use crate :: event;
@@ -354,13 +355,13 @@ mod test {
354355
355356 const STREAM_ID : & str = "stream:test" ;
356357
357- lazy_static ! {
358- static ref EVENTS : Vec <event :: Envelope < StringMessage >> = vec![
358+ static EVENTS : LazyLock < Vec < event :: Envelope < StringMessage > > > = LazyLock :: new ( || {
359+ vec ! [
359360 event:: Envelope :: from( StringMessage ( "event-1" ) ) ,
360361 event:: Envelope :: from( StringMessage ( "event-2" ) ) ,
361362 event:: Envelope :: from( StringMessage ( "event-3" ) ) ,
362- ] ;
363- }
363+ ]
364+ } ) ;
364365
365366 #[ tokio:: test]
366367 async fn it_works ( ) {
You can’t perform that action at this time.
0 commit comments