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:
2026-06-08 05:34:15 +00:00
parent b0a885ea40
commit 619a6dcc77
7 changed files with 76 additions and 42 deletions

View File

@@ -7,6 +7,7 @@ use crate::auth::IdentityProvider;
use crate::config::DynamicConfig;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum InterfaceKind {
Ssh,
RawFraming,
@@ -21,6 +22,7 @@ impl std::fmt::Display for InterfaceKind {
}
}
#[non_exhaustive]
pub enum InterfaceConfig {
Ssh(SshInterfaceConfig),
RawFraming(RawFramingConfig),
@@ -28,9 +30,11 @@ pub enum InterfaceConfig {
impl InterfaceConfig {
pub fn kind(&self) -> InterfaceKind {
#[allow(unreachable_patterns)]
match self {
InterfaceConfig::Ssh(_) => InterfaceKind::Ssh,
InterfaceConfig::RawFraming(_) => InterfaceKind::RawFraming,
_ => InterfaceKind::Ssh,
}
}
}