Conversation
There was a problem hiding this comment.
Pull request overview
Enables consumers to read project-specific/unknown TOML configuration by capturing unrecognized keys into an extra map on ProjectConfig.
Changes:
- Re-export
tomlfrom the crate root for easier access totomltypes. - Add
extra: toml::TabletoProjectConfigusing#[serde(flatten)]and initialize it in the builder. - Add a unit test verifying extra config can be deserialized into a custom struct.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cot/src/lib.rs | Re-exports toml to support working with the new ProjectConfig::extra field. |
| cot/src/config.rs | Adds ProjectConfig::extra to retain unknown TOML keys and tests access/deserialization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// This is all the project-specific configuration data that can (and makes | ||
| /// sense to) be expressed in a TOML configuration file. | ||
| #[derive(Debug, Clone, PartialEq, Eq, Builder, Serialize, Deserialize)] | ||
| #[derive(Debug, Clone, Builder, Serialize, Deserialize)] |
There was a problem hiding this comment.
Removing PartialEq/Eq from ProjectConfig is a breaking public API change (downstream code may rely on equality comparisons). If toml::Table prevents deriving Eq, consider restoring at least PartialEq (either via derive if supported, or via a manual impl PartialEq), or document this as a breaking change requiring a major version bump.
| #[derive(Debug, Clone, Builder, Serialize, Deserialize)] | |
| #[derive(Debug, Clone, PartialEq, Builder, Serialize, Deserialize)] |
| pub use http; | ||
| #[cfg(feature = "openapi")] | ||
| pub use schemars; | ||
| pub use toml; |
There was a problem hiding this comment.
Re-exporting the entire toml crate expands your public surface area and tightly couples your semver to toml’s API (any toml breaking change can become your breaking change). Prefer re-exporting only the needed items (e.g., toml::Table / toml::Value) or exposing them through your own types to keep the public API smaller and more stable.
| pub use toml; | |
| pub use toml::{Table, Value}; |
|
| Branch | extra-config |
| Testbed | github-ubuntu-latest |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result microseconds (µs) (Result Δ%) | Upper Boundary microseconds (µs) (Limit %) |
|---|---|---|---|
| empty_router/empty_router | 📈 view plot 🚷 view threshold | 6,437.50 µs(+7.69%)Baseline: 5,977.82 µs | 7,170.38 µs (89.78%) |
| json_api/json_api | 📈 view plot 🚷 view threshold | 1,081.50 µs(+4.68%)Baseline: 1,033.12 µs | 1,191.23 µs (90.79%) |
| nested_routers/nested_routers | 📈 view plot 🚷 view threshold | 1,010.90 µs(+6.15%)Baseline: 952.34 µs | 1,092.51 µs (92.53%) |
| single_root_route/single_root_route | 📈 view plot 🚷 view threshold | 973.62 µs(+6.57%)Baseline: 913.60 µs | 1,051.21 µs (92.62%) |
| single_root_route_burst/single_root_route_burst | 📈 view plot 🚷 view threshold | 18,500.00 µs(+5.05%)Baseline: 17,610.86 µs | 21,143.00 µs (87.50%) |
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
No description provided.