#repository #database


Abstract data persistence in a safe and unified way

4 releases

new 0.2.0 Jan 25, 2023
0.1.2 Jan 20, 2023
0.1.1 Jan 20, 2023
0.1.0 Jan 20, 2023

#381 in Database interfaces

Download history 33/week @ 2023-01-14 57/week @ 2023-01-21

90 downloads per month
Used in typesafe_repository_macro

MIT license

1.5K SLoC


  • Identity traits (plus helper types like ValidIdentity and IdentityOf)
  • Repository traits like Add, Get, List
  • No need to use unimplemented!() or blanket implementations- construct your own repository based on set of traits
  • No heavy macro magic
  • Transactional repository traits based on HCons with rollback feature
  • Transactional wrapper for repository, which can be used both as plain repository inheriting behavior of inner repository, or transactional repository
  • Perform operations on many repositories in one transaction


  • Provide flexible and abstract generic-based repository traits
  • Easy transaction implementation
  • Non-essential features are optional
  • No unsafe and panics
  • No runtime errors caused by library
  • No enforced error types


  • transactional traits and RepositoryWrapper
  • RepositoryWrapper rollback support
  • seamless transactional and non-transactional interop for RepositoryWrapper
  • IdentityBy-like trait for marker structs
  • pointer-based ValidIdentity
  • pass previous operation result as next operation argument in transactions
  • sync/async operations with optional features
  • optional serde support
  • sync transactions support
  • HCons wrapper for more convenient output extraction
  • TransactionRunner settings and different mappers
  • transaction log
  • trait generation based on methods names (like in Spring repositories)


Many generic bounds were made out of heuristics, so feel free to propose reasonable bound changes

Project is in early stage, expect breaking API changes


~131K SLoC