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 | 5,781.80 µs(-3.70%)Baseline: 6,004.20 µs | 7,247.80 µs (79.77%) |
| json_api/json_api | 📈 view plot 🚷 view threshold | 1,017.20 µs(-2.42%)Baseline: 1,042.43 µs | 1,223.43 µs (83.14%) |
| nested_routers/nested_routers | 📈 view plot 🚷 view threshold | 991.99 µs(+3.40%)Baseline: 959.33 µs | 1,115.96 µs (88.89%) |
| single_root_route/single_root_route | 📈 view plot 🚷 view threshold | 957.71 µs(+3.95%)Baseline: 921.29 µs | 1,078.56 µs (88.80%) |
| single_root_route_burst/single_root_route_burst | 📈 view plot 🚷 view threshold | 17,178.00 µs(-2.69%)Baseline: 17,653.45 µs | 21,121.38 µs (81.33%) |
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.