khonsulabs / bonsaidb

A developer-friendly document database that grows with you, written in Rust
https://bonsaidb.io/
Apache License 2.0
1.01k stars 37 forks source link

Compile Issue with Release Version 0.4.1 #266

Closed kohlten closed 1 year ago

kohlten commented 1 year ago

Hello,

The currently published version of bonsaidb has these compile errors:

error[E0046]: not all trait items implemented, missing: `set_user_password`, `authenticate`
   --> /home/kohlten/.cargo/registry/src/github.com-1ecc6299db9ec823/bonsaidb-client-0.4.1/src/client.rs:615:1
    |
615 | impl AsyncStorageConnection for Client {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `set_user_password`, `authenticate` in implementation
    |
    = help: implement the missing item: `fn set_user_password<U>(&'life0 self, _: U, _: SensitiveString) -> Pin<Box<(dyn futures::Future<Output = Result<(), bonsaidb_core::Error>> + std::marker::Send + 'async_trait)>> where U: Nameable, U: std::marker::Send, U: Sync { todo!() }`
    = help: implement the missing item: `fn authenticate<U>(&'life0 self, _: U, _: Authentication) -> Pin<Box<(dyn futures::Future<Output = Result<<Self as AsyncStorageConnection>::Authenticated, bonsaidb_core::Error>> + std::marker::Send + 'async_trait)>> where U: Nameable, U: std::marker::Send, U: Sync { todo!() }`

error[E0046]: not all trait items implemented, missing: `set_user_password`, `authenticate`
   --> /home/kohlten/.cargo/registry/src/github.com-1ecc6299db9ec823/bonsaidb-local-0.4.1/src/storage.rs:881:1
    |
881 | impl StorageConnection for StorageInstance {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `set_user_password`, `authenticate` in implementation
    |
    = help: implement the missing item: `fn set_user_password<U>(&self, _: U, _: SensitiveString) -> Result<(), bonsaidb_core::Error> where U: Nameable, U: Send, U: Sync { todo!() }`
    = help: implement the missing item: `fn authenticate<U>(&self, _: U, _: Authentication) -> Result<<Self as StorageConnection>::Authenticated, bonsaidb_core::Error> where U: Nameable, U: Send, U: Sync { todo!() }`

error[E0046]: not all trait items implemented, missing: `set_user_password`, `authenticate`
    --> /home/kohlten/.cargo/registry/src/github.com-1ecc6299db9ec823/bonsaidb-local-0.4.1/src/storage.rs:1138:1
     |
1138 | impl StorageConnection for Storage {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `set_user_password`, `authenticate` in implementation
     |
     = help: implement the missing item: `fn set_user_password<U>(&self, _: U, _: SensitiveString) -> Result<(), bonsaidb_core::Error> where U: Nameable, U: Send, U: Sync { todo!() }`
     = help: implement the missing item: `fn authenticate<U>(&self, _: U, _: Authentication) -> Result<<Self as StorageConnection>::Authenticated, bonsaidb_core::Error> where U: Nameable, U: Send, U: Sync { todo!() }`

error[E0046]: not all trait items implemented, missing: `set_user_password`, `authenticate`
  --> /home/kohlten/.cargo/registry/src/github.com-1ecc6299db9ec823/bonsaidb-client-0.4.1/src/client/sync.rs:31:1
   |
31 | impl StorageConnection for Client {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `set_user_password`, `authenticate` in implementation
   |
   = help: implement the missing item: `fn set_user_password<U>(&self, _: U, _: SensitiveString) -> Result<(), bonsaidb_core::Error> where U: Nameable, U: std::marker::Send, U: Sync { todo!() }`
   = help: implement the missing item: `fn authenticate<U>(&self, _: U, _: Authentication) -> Result<<Self as StorageConnection>::Authenticated, bonsaidb_core::Error> where U: Nameable, U: std::marker::Send, U: Sync { todo!() }`

error[E0046]: not all trait items implemented, missing: `set_user_password`, `authenticate`
   --> /home/kohlten/.cargo/registry/src/github.com-1ecc6299db9ec823/bonsaidb-local-0.4.1/src/async.rs:360:1
    |
360 | impl AsyncStorageConnection for AsyncStorage {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `set_user_password`, `authenticate` in implementation
    |
    = help: implement the missing item: `fn set_user_password<U>(&'life0 self, _: U, _: SensitiveString) -> Pin<Box<(dyn Future<Output = Result<(), bonsaidb_core::Error>> + Send + 'async_trait)>> where U: Nameable, U: Send, U: Sync { todo!() }`
    = help: implement the missing item: `fn authenticate<U>(&'life0 self, _: U, _: Authentication) -> Pin<Box<(dyn Future<Output = Result<<Self as AsyncStorageConnection>::Authenticated, bonsaidb_core::Error>> + Send + 'async_trait)>> where U: Nameable, U: Send, U: Sync { todo!() }`

The version on github compiles fine though.

Thanks, Kohlten

ecton commented 1 year ago

Can you share how you've added it to your Cargo.toml? I created an empty project and added this to its Cargo.toml, and it builds:

[dependencies]
bonsaidb = { version = "0.4.1", features = ["client"] }

I tried a few different combinations, and they all are working for me.

kohlten commented 1 year ago

Hello Ecton,

My bad for not posting that originally. After looking into it a little more, I was basing my code off of the Basic Server example. It appears like this issue only happens when using the "password-hashing" feature with either of the "client" or "server" features. This is the basic cargo I was able to get to replicate the issue:

[package]
name = "bonsaidb_test"
version = "0.0.0"
edition = "2021"

[dependencies]
bonsaidb = { version = "0.4.1", features = ["server", "password-hashing", "client"] }

Thanks, Kohlten

ecton commented 1 year ago

Ah, that would be it. The examples have changed since 0.4. Here's the Cargo.toml from the v0.4.1 tag. The main branch implements the new feature flag features introduced in Rust 1.60, which came out a few days after after v0.4.1 was released.

This should work on v0.4.1:

bonsaidb = { version = "0.4.1", features = [
    "server",
    "server-password-hashing",
    "client",
    "client-password-hashing",
] }
kohlten commented 1 year ago

I see, thanks!