Skip to content

Conversation

nthiad
Copy link
Contributor

@nthiad nthiad commented Jun 16, 2025

Changelog

Adds rust data loader example.

Docs

None

Description

This PR adds a rust data loader example with the example file from the foxglove_data_loader in foxglove-sdk/#460 plus the typescript build to generate the extension.

The example in the sdk repo is rust-only to keep that repo simpler and so that users can understand only that rust code in isolation, but the example here in create-foxglove-extension is more complete and something we can point people to for everything they will need to make an extension of their own.

Replaces #169.

Fixes: FG-11789

Depends on foxglove/foxglove-sdk#460

Copy link

linear bot commented Jun 16, 2025

@nthiad
Copy link
Contributor Author

nthiad commented Jun 16, 2025

prost = "0.13"
serde = { version = "1.0", features = [ "derive" ] }
foxglove_data_loader = { path = "../../../../sdk/rust/foxglove_data_loader" }
foxglove_data_loader = { git = "https://github.com/foxglove/foxglove-sdk.git" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we set this to a specific commit so that if we iterate on the api the example remains valid until we explicitly update it?

Copy link
Contributor Author

@nthiad nthiad Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that could work so long as the WIT interface upstream in app doesn't change very often

@nthiad
Copy link
Contributor Author

nthiad commented Jun 25, 2025

Upstream in foxglove_data_loader I added init.get_channel() and updated this example to pass the init object down to the iterator. Now the init object can manage the mappings based on topics, which I feel is much nicer than adding a struct field in the data loader and message iterator for each channel to save its id.

let init = self.init.borrow();
let acc_ch_id = init.get_channel("/accelerometer").unwrap().id;
let temp_ch_id = init.get_channel("/temperature").unwrap().id;

@nthiad
Copy link
Contributor Author

nthiad commented Jun 25, 2025

Now the trait interface methods are &mut self so I was able to remove the RefCells so we don't have to explain those to users.

@james-rms james-rms merged commit 513975a into main Jul 21, 2025
4 checks passed
@james-rms james-rms deleted the synthia/fg-11789-create-foxglove-extension-support-for-data-loaders branch July 21, 2025 21:51
@achim-k achim-k mentioned this pull request Jul 24, 2025
achim-k added a commit that referenced this pull request Jul 24, 2025
### Changelog
None

### Docs
None

### Description
New release. Notable changes:
- #173
- #171
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants