Skip to content

Ergonomics around use in a stateful application (like Tauri) #69

Answered by vincent-herlemont
Gawdl3y asked this question in Q&A
Discussion options

You must be logged in to vote

As I've explained here, the 'static is mandatory because Tauri does not use thread scoped. In reality, in a different context, 'static is not needed.

However, it's true that in the case of Tauri, it's necessary. I've created a small example project to explore possibilities. Feel free to get inspiration (I used Lazy in the builder like you did) from it and critique it 👉 native_db_tauri_vanilla :).

An important thing to note is that I saw you used unsafe in your first example, and it would be advisable to avoid using it.

NOTE: Regarding the removal of the reference in TableDefinition.TableDefinition implements the Copy trait, which implies copying the reference and not cloning the value, I …

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
4 replies
@vincent-herlemont
Comment options

@vincent-herlemont
Comment options

@Gawdl3y
Comment options

@Gawdl3y
Comment options

Comment options

You must be logged in to vote
4 replies
@Gawdl3y
Comment options

@vincent-herlemont
Comment options

Answer selected by Gawdl3y
@Gawdl3y
Comment options

@vincent-herlemont
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants