dermesser / leveldb-rs

A reimplementation of LevelDB in Rust (no bindings).
Other
515 stars 60 forks source link

Implement `Clone` for `AsyncDB` #39

Closed Velnbur closed 1 year ago

Velnbur commented 1 year ago

Problem

I think that this is a common use case, when you are using AsyncDB you want to pass it to each subservice by cloning, for example.

Consideration

As AsyncDB is just a wrapper around tokio::mpsc channel, there should be no problem with just deriving Clone. Expect JoinHandle, for that we can just wrap it around Arc and it will drop when last reference will be dropped

Solution

Derive Clone for AsyncDB, and add Arc around JoinHandle (see #40)

dermesser commented 1 year ago

40 has been merged.