dimas_com/enums/
communicator_implementations.rs

1// Copyright © 2024 Stephan Kunz
2
3#[doc(hidden)]
4extern crate alloc;
5
6use alloc::sync::Arc;
7use zenoh::Session;
8
9use crate::traits::CommunicatorImplementationMethods;
10
11/// the known implementations of communicators
12#[derive(Debug)]
13pub enum CommunicatorImplementation {
14	/// zenoh
15	Zenoh(crate::zenoh::Communicator),
16}
17
18impl CommunicatorImplementationMethods for CommunicatorImplementation {}
19
20impl CommunicatorImplementation {
21	/// extract session
22	#[must_use]
23	#[allow(clippy::match_wildcard_for_single_variants)]
24	pub fn session(&self) -> Arc<Session> {
25		match self {
26			Self::Zenoh(communicator) => communicator.session(),
27		}
28	}
29}