-
Notifications
You must be signed in to change notification settings - Fork 17
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
Database has reference to DatabaseBuilder ? #138
Comments
It's true that DatabaseBuilder and Database are linked. DatabaseBuilder initializes the tables. And the tables are instances of
I don't think it's advisable to use a self-referencing structure technique because Rust seems to inherently prohibit it. And making it static seems too restrictive.
It seems that since what is linked is internal to the redb mechanism, I cannot go against it. @dai1975 What do you think, do you have other ideas? These other threads might be interesting: |
Hi @vincent-herlemont , I bump into the same problem as dai1975. Can you suggest any design approach that will allow me to include native_db in my project?
edit: I've read the discussion #69. I decided to either go with lazy statics, mutable using
or create and pass the
Usage:
It's not the best for the users of the module, and I hope to remove passing the builder from outside when |
I thought the weak part was having to
so user only needs to |
Hi @Qbicz , below code(self reference structure pattern) may work.
|
Thank you @dai1975 for the example! |
It fails because &builder is not long alive.
There may some solution for this problem, such that use self referencing structure technique or make database builder to be 'static.
But I think it would better that Database implementation simply copy DatabaseBuilder's infomation instead of holding reference to a builder. How about?
The text was updated successfully, but these errors were encountered: