feat(api): add #[non_exhaustive] to public types likely to evolve
ForwardingAction, TargetPattern, ForwardingRule, OperationType, InterfaceConfig, InterfaceKind, DynamicConfig, and CallError are all likely to gain variants/fields in future phases. Marking them #[non_exhaustive] now prevents downstream breakage when new variants/fields are added. Added constructor methods for types that are constructed from other crates.
This commit is contained in:
@@ -229,6 +229,7 @@ impl Default for RateLimitConfig {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[non_exhaustive]
|
||||
pub struct DynamicConfig {
|
||||
pub auth: AuthPolicy,
|
||||
pub forwarding: ForwardingPolicy,
|
||||
@@ -244,6 +245,18 @@ impl DynamicConfig {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_parts(
|
||||
auth: AuthPolicy,
|
||||
forwarding: ForwardingPolicy,
|
||||
rate_limits: RateLimitConfig,
|
||||
) -> Self {
|
||||
Self {
|
||||
auth,
|
||||
forwarding,
|
||||
rate_limits,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_forwarding_policy(mut self, policy: ForwardingPolicy) -> Self {
|
||||
self.forwarding = policy;
|
||||
self
|
||||
|
||||
Reference in New Issue
Block a user