Closed jamesaoverton closed 10 months ago
I have added the stubs from this PR in this commit which has been pushed to the branch new-api-forked-from-guess which is being tracked by PR #70.
This PR (#68) can now be closed unless further discussion is required.
Here is a draft API for discussion. I think it is fairly idiomatic Rust, and would be easy to use in Nanobot.
The code does not compile, but short of that I tried to include as much information as possible. Although I created a separate
api.rs
file, I would expect this code to be part oflib.rs
.Some points for discussion:
Valve
struct that I'm proposing could usually be created as immutable, because the configuration data does not change. The main exception is theconnect()
method. The Rust Book talks about the interior mutability pattern which could be used in this case, I guess. Orbuild()
could take two arguments: table table path and database connection string.