Skip to content

Instantly share code, notes, and snippets.

@trimoq
Last active January 8, 2020 14:35
Show Gist options
  • Save trimoq/c19df28a3cd0902f7746933d8d62812f to your computer and use it in GitHub Desktop.
Save trimoq/c19df28a3cd0902f7746933d8d62812f to your computer and use it in GitHub Desktop.
The UserRepository with two imlementations
trait UserRepository{
fn store(&self, user: User);
fn load(&self, id: u32) -> Result<User,Error>;
}
struct PostgresUserRepository;
struct DummyUserRepository;
impl UserRepository for PostgresUserRepository{
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment