Using the database definition of ACID, one can argue:
Rust objects are aCId
-
Isolation: can't have two &mut ensures that each sequence of mutations happens in isolation
-
Consistency: can't have &mut while read & exists ensures that all reads are consistent
-
It's not really Atomic, since in the middle of a &mut self function, something bad might happen, we return a Result<.., Err> with half written state
-
Definitely not durable.
Haskell / Erlang / Elixir / Rust using only immutable-rs are ACId
- Using a codding style that uses purely persistent data structures with a "pointer swap" at the root guarantees Atomicity; if a function fails, there are no partial updates; if the function succeeds, it returns a new good value.
So here, by restricting ourselves to using only immutable-rs, we can 'boost' Rust objects from aCId to ACId.
sql is ACID (in properly configured db); rust + ??? has ACID objects ?
In a properly configured DB, after SQL statements are executed, the updates are durable.
Question: besides the "use an ORM + database" crates, are there any other crates / techniques that promotes Rust objects to "ACID" ?
Note: restricting to immutable-rs already takes Rust objects from aCId to ACId, without depending on an external db. Are there crates that takes us from ACId to ACID without using an external db ?