Struct zenoh_protocol::session::SessionManagerConfig [−][src]
Examples
use async_std::sync::Arc; use async_trait::async_trait; use zenoh_protocol::core::{PeerId, WhatAmI, whatami}; use zenoh_protocol::session::{DummySessionEventHandler, SessionEventHandler, Session, SessionHandler, SessionManager, SessionManagerConfig, SessionManagerOptionalConfig}; use zenoh_util::core::ZResult; // Create my session handler to be notified when a new session is initiated with me struct MySH; impl MySH { fn new() -> MySH { MySH } } #[async_trait] impl SessionHandler for MySH { async fn new_session(&self, _session: Session ) -> ZResult<Arc<dyn SessionEventHandler + Send + Sync>> { Ok(Arc::new(DummySessionEventHandler::new())) } } // Create the SessionManager let config = SessionManagerConfig { version: 0, whatami: whatami::PEER, id: PeerId::from(uuid::Uuid::new_v4()), handler: Arc::new(MySH::new()) }; let manager = SessionManager::new(config, None); // Create the SessionManager with optional configuration let config = SessionManagerConfig { version: 0, whatami: whatami::PEER, id: PeerId::from(uuid::Uuid::new_v4()), handler: Arc::new(MySH::new()) }; // Setting a value to None means to use the default value let opt_config = SessionManagerOptionalConfig { lease: Some(1_000), // Set the default lease to 1s keep_alive: Some(100), // Set the default keep alive interval to 100ms sn_resolution: None, // Use the default sequence number resolution batch_size: None, // Use the default batch size timeout: Some(10_000), // Timeout of 10s when opening a session retries: Some(3), // Tries to open a session 3 times before failure max_sessions: Some(5), // Accept any number of sessions max_links: None, // Allow any number of links in a single session peer_authenticator: None, // Accept any incoming session link_authenticator: None, // Accept any incoming link }; let manager_opt = SessionManager::new(config, Some(opt_config));
Fields
version: u8
whatami: WhatAmI
id: PeerId
handler: Arc<dyn SessionHandler + Send + Sync>
Auto Trait Implementations
impl !RefUnwindSafe for SessionManagerConfig
[src]
impl Send for SessionManagerConfig
[src]
impl Sync for SessionManagerConfig
[src]
impl Unpin for SessionManagerConfig
[src]
impl !UnwindSafe for SessionManagerConfig
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,