-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add no_std support to diesel #4906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
05905e3 to
cf53096
Compare
cf53096 to
e02c478
Compare
f8a6772 to
0bdf1c0
Compare
0bdf1c0 to
6ac1983
Compare
|
@LucaCappelletti94 You ask where you could help. This PR could use a review from someone that's not me 😉 |
LucaCappelletti94
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few minor core -> ::core changes needed for consistency
diesel_derives/src/sql_function.rs
Outdated
| ) -> QueryResult<()> | ||
| where | ||
| F: Fn(#(#arg_name,)*) -> Ret + std::panic::UnwindSafe + Send + 'static, | ||
| F: Fn(#(#arg_name,)*) -> Ret + core::panic::UnwindSafe + Send + 'static, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency this should be ::core I believe
diesel_derives/src/sql_function.rs
Outdated
| ) -> QueryResult<()> | ||
| where | ||
| F: FnMut(#(#arg_name,)*) -> Ret + std::panic::UnwindSafe + Send + 'static, | ||
| F: FnMut(#(#arg_name,)*) -> Ret + core::panic::UnwindSafe + Send + 'static, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency this should be ::core I believe
diesel_derives/src/sql_function.rs
Outdated
| ) -> QueryResult<()> | ||
| where | ||
| F: Fn() -> Ret + std::panic::UnwindSafe + Send + 'static, | ||
| F: Fn() -> Ret + core::panic::UnwindSafe + Send + 'static, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency this should be ::core I believe
diesel_derives/src/sql_function.rs
Outdated
| ) -> QueryResult<()> | ||
| where | ||
| F: FnMut() -> Ret + std::panic::UnwindSafe + Send + 'static, | ||
| F: FnMut() -> Ret + core::panic::UnwindSafe + Send + 'static, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency this should be ::core I believe
diesel_derives/src/sql_function.rs
Outdated
| + std::panic::UnwindSafe | ||
| + std::panic::RefUnwindSafe, | ||
| + core::panic::UnwindSafe | ||
| + core::panic::RefUnwindSafe, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency these should be ::core I believe
6ac1983 to
c1867fb
Compare
c1867fb to
a8554fd
Compare
This commit adds support for using diesel with the SQLite backend in a no-std (core + alloc) environment. This mainly means fixing a lot of imports to use the relevant items from core or alloc instead. Notable exceptions are: * There is no hashmap in alloc, so we need to pull in hashbrown for this * There is no panicing/abort support in core so we need our custom shims for these. * Global instrumentation setting is not supported yet (cfged away) as it requires lock which are not supported on embedded targets. This commit also introduces a new `std` default feature for enabling `std` lib support. If disabled the users need to manually enable the `hashbrown` feature to pull in hashbrown for hashmap support. Cargo doesn't support pulling in dependencies for disabled features. Finally this commit also adds a `example/sqlite/embedded` example project that demonstrates how to use this on a esp32-c6.
a8554fd to
6ca3911
Compare
This commit adds support for using diesel with the SQLite backend
in a no-std (core + alloc) environment.
This mainly means fixing a lot of imports to use the relevant items from core or alloc instead. Notable exceptions are:
This commit also introduces a new
stddefault feature for enablingstdlib support. If disabled the users need to manually enable thehashbrownfeature to pull in hashbrown for hashmap support. Cargo doesn't support pulling in dependencies for disabled features.Finally this commit also adds a
example/sqlite/embeddedexample project that demonstrates how to use this on a esp32-c6.This is marked as a draft for now as there are a few upstream things that I would like to resolve properly before merging this: