-
Notifications
You must be signed in to change notification settings - Fork 39
rust data loaders #460
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
base: main
Are you sure you want to change the base?
rust data loaders #460
Conversation
Once I have this in a source file - what do I do to build it? |
My editor keeps removing the leading |
I agree. The issue is that wit-bindgen defines the |
The |
I hid all the Guest traits and made |
Co-authored-by: Roman Shtylman <[email protected]>
If we have an example, we should include an example of doing mutable state with RefCell because the |
Gave this a spin writing a basic mp4 data loader using this branch paired with https://github.com/foxglove/app/pull/9659. I've ticketed my feedback here:
Generally my vibe is this is a great pairing with the app-side experimental PR and something we can get folks tire kicking with. As for what might block this PR merging I have the following thoughts:
|
I haven't seen this as much in crates, mostly in rust itself, but here is one example: It's more complicated in our case because we are using features to gate against wasm-specific functionality already to to also gate for stability we could rename the feature |
Since this is a separate crate, one way we can do this is just not publish the crate. Add a readme saying its experimental and must be imported as a git crate. |
I've removed the ndjson example from this PR in favor of the location in create-foxglove-extension with my other PR so that we only have one copy of this example and so that they don't get out of sync. I'll add a follow-up PR to this crate with a different example and I'll apply all the example feedback here to the ndjson rust example in create-foxglove-extension. |
…e-a-data-loader-via-the-sdk
…ing as a dep from non-path works outside of project
Changelog
Adds a
foxglove_data_loader
crate for writing foxglove data loader extensions in rust that compile to wasm.Docs
FG-11831
Description
This PR adds a
foxglove_data_loader
crate withDataLoader
andMessageIterator
traits for user code to implement plus afoxglove_data_loader::export!()
macro which exports user data loader implementation to the wasm component build.The wasm output of builds made with this interface can be passed as
wasmUrl
toextensionContext.registerDataLoader()
.Usage looks like:
There is a
data_loader::reader::open(&path)
function that returns a Reader from the internal WIT. Theinputs
vec contains a list of path strings you canreader::open()
.std::io::Read
andstd::io::Seek
are implemented for the WIT Reader to make it easier to use with the rest of the rust ecosystem. For example, you can do things like:Depends on https://github.com/foxglove/app/pull/9659
Fixes: FG-11694