Add Event::config

This commit is contained in:
Joscha 2023-01-23 18:32:09 +01:00
parent 9315e5798c
commit 24e2da9fd3

View file

@ -184,6 +184,18 @@ pub enum Event {
Stopped(InstanceConfig),
}
impl Event {
pub fn config(&self) -> &InstanceConfig {
match self {
Self::Connecting(config) => config,
Self::Connected(config, _) => config,
Self::Packet(config, _, _) => config,
Self::Disconnected(config) => config,
Self::Stopped(config) => config,
}
}
}
enum Request {
GetConnTx(oneshot::Sender<ConnTx>),
Stop,