Skip to content

feat: structured ComponentConfig deserialization via cu29-value#762

Merged
makeecat merged 1 commit into
masterfrom
yang/feat/composable_cu29_value
Jan 30, 2026
Merged

feat: structured ComponentConfig deserialization via cu29-value#762
makeecat merged 1 commit into
masterfrom
yang/feat/composable_cu29_value

Conversation

@makeecat

@makeecat makeecat commented Jan 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Introduce a typed get_value helper on ComponentConfig that converts RON values into cu29_value::Value and deserializes into user-defined structs, with clearer error context and tests covering structured configs.

Related Issue: #720

Change

  • Add ComponentConfig::get_value<T> to deserialize nested config entries into typed structs using cu29_value.
  • Add ron_value_to_cu_value converter (including map/seq/option handling and no_std BTreeMap support).
  • Add ConfigError::with_key to include the failing config key in error messages.
  • Add tests for structured configs, mixed scalar/struct usage, and key-labeled errors.

Impact (how can be used for RON configuration)

You can now encode richer, nested RON configuration and deserialize it directly into typed
Rust structs instead of manually parsing scalars.

Example RON (task config):

config: {
  "settings": {
    "gain": 1.5,
    "matrix": [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]],
    "inner": { "threshold": 42, "flags": Some(true) },
    "tags": ["alpha", "beta"],
  },
}

Example usage:

#[derive(serde::Deserialize)]
struct SettingsConfig { /* ... */ }

let settings: SettingsConfig = component.get_value("settings")?.unwrap();

This enables strongly typed, nested configs in RON while keeping the existing scalar get::<T> path unchanged.

@makeecat makeecat requested a review from gbin January 28, 2026 22:04
@makeecat makeecat self-assigned this Jan 28, 2026
@makeecat makeecat added enhancement New feature or request include in changelog labels Jan 28, 2026
@makeecat makeecat linked an issue Jan 28, 2026 that may be closed by this pull request
@gbin

gbin commented Jan 28, 2026

Copy link
Copy Markdown
Collaborator

That is cool!

@makeecat makeecat merged commit 77c3556 into master Jan 30, 2026
26 checks passed
@makeecat makeecat deleted the yang/feat/composable_cu29_value branch January 30, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explore using composable cu29-value for the component configs

2 participants