diff --git a/zenoh-plugin-ros1/examples/ros1_pub.rs b/zenoh-plugin-ros1/examples/ros1_pub.rs index f89b3b9..757c866 100644 --- a/zenoh-plugin-ros1/examples/ros1_pub.rs +++ b/zenoh-plugin-ros1/examples/ros1_pub.rs @@ -12,7 +12,6 @@ // ZettaScale Zenoh Team, // -use zenoh::prelude::*; use zenoh_plugin_ros1::ros_to_zenoh_bridge::{ environment::Environment, ros1_master_ctrl::Ros1MasterCtrl, Ros1ToZenohBridge, }; @@ -52,10 +51,7 @@ async fn main() { // create Zenoh session and subscriber print!("Creating Zenoh Session..."); - let zenoh_session = zenoh::open(zenoh::config::default()) - .await - .unwrap() - .into_arc(); + let zenoh_session = zenoh::open(zenoh::config::default()).await.unwrap(); println!(" OK!"); print!("Creating Zenoh Subscriber..."); #[allow(unused_variables)] diff --git a/zenoh-plugin-ros1/examples/ros1_service.rs b/zenoh-plugin-ros1/examples/ros1_service.rs index e7b2633..c48430d 100644 --- a/zenoh-plugin-ros1/examples/ros1_service.rs +++ b/zenoh-plugin-ros1/examples/ros1_service.rs @@ -58,10 +58,7 @@ async fn main() { // create Zenoh session print!("Creating Zenoh Session..."); - let zenoh_session = zenoh::open(zenoh::config::default()) - .await - .unwrap() - .into_arc(); + let zenoh_session = zenoh::open(zenoh::config::default()).await.unwrap(); println!(" OK!"); // here bridge will expose our test ROS topic to Zenoh so that our ROS1 subscriber will get data published in Zenoh diff --git a/zenoh-plugin-ros1/examples/ros1_sub.rs b/zenoh-plugin-ros1/examples/ros1_sub.rs index 7b857b7..51ae5a4 100644 --- a/zenoh-plugin-ros1/examples/ros1_sub.rs +++ b/zenoh-plugin-ros1/examples/ros1_sub.rs @@ -12,7 +12,6 @@ // ZettaScale Zenoh Team, // -use zenoh::prelude::*; use zenoh_plugin_ros1::ros_to_zenoh_bridge::{ environment::Environment, ros1_master_ctrl::Ros1MasterCtrl, Ros1ToZenohBridge, }; @@ -55,7 +54,7 @@ async fn main() { // create Zenoh session and publisher print!("Creating Zenoh Session..."); - let zenoh_session = zenoh::open(zenoh::config::peer()).await.unwrap().into_arc(); + let zenoh_session = zenoh::open(zenoh::config::peer()).await.unwrap(); println!(" OK!"); print!("Creating Zenoh Publisher..."); let zenoh_publisher = zenoh_session diff --git a/zenoh-plugin-ros1/tests/aloha_declaration_test.rs b/zenoh-plugin-ros1/tests/aloha_declaration_test.rs index 9730f72..2bf6897 100644 --- a/zenoh-plugin-ros1/tests/aloha_declaration_test.rs +++ b/zenoh-plugin-ros1/tests/aloha_declaration_test.rs @@ -21,7 +21,7 @@ use std::{ use test_case::test_case; use tokio::sync::Mutex; -use zenoh::{key_expr::OwnedKeyExpr, prelude::*, session::OpenBuilder, Result as ZResult, Session}; +use zenoh::{key_expr::OwnedKeyExpr, session::OpenBuilder, Result as ZResult, Session, Wait}; use zenoh_plugin_ros1::ros_to_zenoh_bridge::{ aloha_declaration, aloha_subscription, test_helpers::IsolatedConfig, }; @@ -55,7 +55,7 @@ fn subscription_builder( } fn make_session(cfg: &IsolatedConfig) -> Session { - session_builder(cfg).wait().unwrap().into_arc() + session_builder(cfg).wait().unwrap() } async fn make_subscription( @@ -92,17 +92,17 @@ async fn aloha_instantination_many_instances() { } } -pub struct PPCMeasurement<'a> { - _subscriber: zenoh::pubsub::Subscriber<'a, ()>, +pub struct PPCMeasurement { + _subscriber: zenoh::pubsub::Subscriber<()>, ppc: Arc, measurement_period: Duration, } -impl<'a> PPCMeasurement<'a> { +impl PPCMeasurement { pub async fn new( - session: &'a Session, + session: &Session, key: String, measurement_period: Duration, - ) -> ZResult> { + ) -> ZResult { let ppc = Arc::new(AtomicUsize::new(0)); let p = ppc.clone(); let subscriber = session @@ -204,13 +204,13 @@ impl State { } } -async fn test_state_transition<'a>( +async fn test_state_transition( cfg: &IsolatedConfig, beacon_period: Duration, declaring_sessions: &mut Vec, declarations: &mut Vec, collector: &mut DeclarationCollector, - ppc_measurer: &'a PPCMeasurement<'a>, + ppc_measurer: &PPCMeasurement, state: &State, ) { let ke = zenoh::key_expr::OwnedKeyExpr::from_str("key").unwrap(); @@ -240,7 +240,7 @@ async fn test_state_transition<'a>( while declarations.len() < state.declarators_count { if declaring_sessions.len() <= declarations.len() { - declaring_sessions.push(session_builder(cfg).await.unwrap().into_arc()); + declaring_sessions.push(session_builder(cfg).await.unwrap()); } declarations.push(declaration_builder( declaring_sessions[declarations.len()].clone(), @@ -265,7 +265,7 @@ async fn run_aloha(beacon_period: Duration, scenario: Vec) { let mut declarations: Vec = Vec::new(); let mut collector = DeclarationCollector::new(); - let subscription_session = session_builder(&cfg).await.unwrap().into_arc(); + let subscription_session = session_builder(&cfg).await.unwrap(); let _subscriber = collector .use_builder(subscription_builder( subscription_session.clone(), diff --git a/zenoh-plugin-ros1/tests/discovery_test.rs b/zenoh-plugin-ros1/tests/discovery_test.rs index deb275b..9b63cb4 100644 --- a/zenoh-plugin-ros1/tests/discovery_test.rs +++ b/zenoh-plugin-ros1/tests/discovery_test.rs @@ -19,7 +19,7 @@ use std::{ use multiset::HashMultiSet; use test_case::test_case; -use zenoh::{key_expr::keyexpr, prelude::*, session::OpenBuilder, Session}; +use zenoh::{key_expr::keyexpr, session::OpenBuilder, Session, Wait}; use zenoh_plugin_ros1::ros_to_zenoh_bridge::{ discovery::{self, LocalResources, RemoteResources}, test_helpers::{BridgeChecker, IsolatedConfig}, @@ -37,7 +37,7 @@ fn remote_resources_builder(session: Session) -> discovery::RemoteResourcesBuild } fn make_session(cfg: &IsolatedConfig) -> Session { - session_builder(cfg).wait().unwrap().into_arc() + session_builder(cfg).wait().unwrap() } fn make_local_resources(session: Session) -> LocalResources { @@ -280,11 +280,11 @@ async fn test_state_transition( async fn run_discovery(scenario: Vec) { let cfg = IsolatedConfig::default(); - let src_session = session_builder(&cfg).await.unwrap().into_arc(); + let src_session = session_builder(&cfg).await.unwrap(); let local_resources = make_local_resources(src_session.clone()); let rcv = DiscoveryCollector::new(); - let rcv_session = session_builder(&cfg).await.unwrap().into_arc(); + let rcv_session = session_builder(&cfg).await.unwrap(); let _rcv_discovery = rcv .use_builder(remote_resources_builder(rcv_session)) .build() diff --git a/zenoh-plugin-ros1/tests/ping_pong_test.rs b/zenoh-plugin-ros1/tests/ping_pong_test.rs index 17eb216..b656a99 100644 --- a/zenoh-plugin-ros1/tests/ping_pong_test.rs +++ b/zenoh-plugin-ros1/tests/ping_pong_test.rs @@ -24,7 +24,7 @@ use std::{ use strum_macros::Display; use tracing::{debug, trace}; -use zenoh::{key_expr::KeyExpr, prelude::*}; +use zenoh::{key_expr::KeyExpr, Wait}; use zenoh_plugin_ros1::ros_to_zenoh_bridge::{ bridging_mode::BridgingMode, discovery::LocalResource,