the.bay.news

API Design for Config Override

The Rust Programming Language Forum
API Design for Config Override
I keep encountering this pattern which I have struggled to find a good solution. There is a global config with non-nullable fields Each item can override some per-item config fields Example: RSS Reader struct App { config: Config, // global config feeds: Vec<Feed>, // per-item config } struct Config { max_retry: u8, browser_agent: String, fetch_interval: std::time::Duration, } struct OptionalConfig { max_retry: Option<u8>, browser_agent: Option<String>, fetch_interval: Option<st...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.