-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from dvdsk/dev
- Loading branch information
Showing
21 changed files
with
139 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
use std::path::Path; | ||
|
||
#[dbstruct::dbstruct(db=sled)] | ||
pub struct Test { | ||
#[dbstruct(Default)] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +0,0 @@ | ||
// pub struct Test<DS: dbstruct::DataStore + std::clone::Clone> { | ||
// ds: DS, | ||
// } | ||
// | ||
// impl<DS> Test<DS> | ||
// where | ||
// DS: dbstruct::DataStore + std::clone::Clone, | ||
// { | ||
// pub fn new(ds: DS) -> Result<Self, dbstruct::Error<DS::Error>> { | ||
// Ok(Self { | ||
// ds, | ||
// ds: std::sync::Arc::new(std::sync::atomic::AtomicUsize::new(0)), | ||
// }) | ||
// } | ||
// fn the_field(&self) -> dbstruct::wrappers::DefaultTrait<u8, DS> { | ||
// dbstruct::wrappers::DefaultTrait::new(self.ds.clone(), 0u8) | ||
// } | ||
// } | ||
// | ||
// fn main() {} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
error: incorrect syntax for backend | ||
|
||
= help: a backend should be a single world not enclosed in " | ||
|
||
--> tests/ui/attribute_does_not_exist.rs:3:14 | ||
| | ||
3 | #[dbstruct(db+)] | ||
| ^ | ||
| | ||
= help: a backend should be a single world not enclosed in " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
error: The database backend (hashmap) you specified can not support all the structs fields | ||
|
||
= help: You need a backend that implements all of these traits: {Ordered}. | ||
Database backends that implement those traits: sled | ||
|
||
--> tests/ui/db_misses_traits.rs:3:15 | ||
| | ||
3 | #[dbstruct(db=hashmap)] | ||
| ^^^^^^^ | ||
| | ||
= help: You need a backend that implements all of these traits: {Ordered}. | ||
Database backends that implement those traits: sled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
error: backend option has no value set | ||
|
||
= help: try setting a supported backend, for example `db=sled` | ||
|
||
--> tests/ui/db_option_misses_value.rs:3:14 | ||
| | ||
3 | #[dbstruct(db=)] | ||
| ^ | ||
| | ||
= help: try setting a supported backend, for example `db=sled` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
error: No database backend specified to use as backend | ||
|
||
= help: specify a backend using #[dbstruct(db=sled)] | ||
|
||
--> tests/ui/db_option_missing.rs:3:1 | ||
| | ||
3 | #[dbstruct] | ||
| ^^^^^^^^^^^ | ||
| | ||
= help: specify a backend using #[dbstruct(db=sled)] | ||
= note: this error originates in the attribute macro `dbstruct` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
error: invalid syntax for dbstruct option | ||
|
||
= help: the option should be a single word not enclosed in " | ||
|
||
--> tests/ui/invalid_attribute_syntax.rs:3:12 | ||
| | ||
3 | #[dbstruct("db"=sled)] | ||
| ^^^^ | ||
| | ||
= help: the option should be a single word not enclosed in " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
error: incorrect syntax for backend | ||
|
||
= help: a backend should be a single world not enclosed in " | ||
|
||
--> tests/ui/invalid_db_value.rs:3:15 | ||
| | ||
3 | #[dbstruct(db="sled")] | ||
| ^^^^^^ | ||
| | ||
= help: a backend should be a single world not enclosed in " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
enum CustomKeyType {} | ||
struct CustomValType; | ||
|
||
fn main() { | ||
// ONCE the output changes and the span starts highlighting the | ||
// key and value type in the struct we can close: https://github.com/dvdsk/dbstruct/issues/13 | ||
|
||
#[dbstruct::dbstruct(db=sled)] | ||
struct PersistentData { | ||
the_map: HashMap<CustomKeyType, CustomValType>, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
error[E0277]: the trait bound `CustomKeyType: serde::ser::Serialize` is not satisfied | ||
--> tests/ui/map_missing_serialize.rs:9:5 | ||
| | ||
9 | #[dbstruct::dbstruct(db=sled)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `serde::ser::Serialize` is not implemented for `CustomKeyType` | ||
| | ||
= help: the following other types implement trait `serde::ser::Serialize`: | ||
&'a T | ||
&'a mut T | ||
() | ||
(T0, T1) | ||
(T0, T1, T2) | ||
(T0, T1, T2, T3) | ||
(T0, T1, T2, T3, T4) | ||
(T0, T1, T2, T3, T4, T5) | ||
and 126 others | ||
note: required by a bound in `dbstruct::wrappers::Map` | ||
--> src/wrappers/map.rs | ||
| | ||
| Key: Serialize, | ||
| ^^^^^^^^^ required by this bound in `dbstruct::wrappers::Map` | ||
= note: this error originates in the attribute macro `dbstruct::dbstruct` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0277]: the trait bound `CustomValType: serde::ser::Serialize` is not satisfied | ||
--> tests/ui/map_missing_serialize.rs:9:5 | ||
| | ||
9 | #[dbstruct::dbstruct(db=sled)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `serde::ser::Serialize` is not implemented for `CustomValType` | ||
| | ||
= help: the following other types implement trait `serde::ser::Serialize`: | ||
&'a T | ||
&'a mut T | ||
() | ||
(T0, T1) | ||
(T0, T1, T2) | ||
(T0, T1, T2, T3) | ||
(T0, T1, T2, T3, T4) | ||
(T0, T1, T2, T3, T4, T5) | ||
and 126 others | ||
note: required by a bound in `dbstruct::wrappers::Map` | ||
--> src/wrappers/map.rs | ||
| | ||
| Value: Serialize + DeserializeOwned, | ||
| ^^^^^^^^^ required by this bound in `dbstruct::wrappers::Map` | ||
= note: this error originates in the attribute macro `dbstruct::dbstruct` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0277]: the trait bound `for<'de> CustomValType: serde::de::Deserialize<'de>` is not satisfied | ||
--> tests/ui/map_missing_serialize.rs:9:5 | ||
| | ||
9 | #[dbstruct::dbstruct(db=sled)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'de> serde::de::Deserialize<'de>` is not implemented for `CustomValType` | ||
| | ||
= help: the following other types implement trait `serde::de::Deserialize<'de>`: | ||
&'a Path | ||
&'a [u8] | ||
&'a str | ||
() | ||
(T0, T1) | ||
(T0, T1, T2) | ||
(T0, T1, T2, T3) | ||
(T0, T1, T2, T3, T4) | ||
and 134 others | ||
= note: required because of the requirements on the impl of `serde::de::DeserializeOwned` for `CustomValType` | ||
note: required by a bound in `dbstruct::wrappers::Map` | ||
--> src/wrappers/map.rs | ||
| | ||
| Value: Serialize + DeserializeOwned, | ||
| ^^^^^^^^^^^^^^^^ required by this bound in `dbstruct::wrappers::Map` | ||
= note: this error originates in the attribute macro `dbstruct::dbstruct` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
error: no database backend specified | ||
|
||
= help: try specifying an db, for example: `db=sled` | ||
|
||
--> tests/ui/missing_db_option.rs:3:12 | ||
| | ||
3 | #[dbstruct(db)] | ||
| ^^ | ||
| | ||
= help: try specifying an db, for example: `db=sled` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
error: multiple database backends specified | ||
--> tests/ui/multiple_backends.rs:3:15 | ||
|
||
= help: remove one of the backends | ||
|
||
--> tests/ui/multiple_backends.rs:3:24 | ||
| | ||
3 | #[dbstruct(db=sled, db=trait)] | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= help: remove one of the backends | ||
| ^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
error: Not a known database backend: `starship_voyager` | ||
|
||
= help: try sled as database backend | ||
|
||
--> tests/ui/not_a_db_backend.rs:3:15 | ||
| | ||
3 | #[dbstruct(db=starship_voyager)] | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
= help: try sled as database backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
error: not a known dbstruct option | ||
|
||
= help: the only supported option currently is: db | ||
|
||
--> tests/ui/unknown_option.rs:3:12 | ||
| | ||
3 | #[dbstruct(starship=enterprise)] | ||
| ^^^^^^^^ | ||
| | ||
= help: the only supported option currently is: db |