Skip to content

Commit

Permalink
Move back to using register_listener() taking ownership of the Arc<dy…
Browse files Browse the repository at this point in the history
…n UListener>
  • Loading branch information
PLeVasseur committed Apr 4, 2024
1 parent 3ef0986 commit ec6ff04
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions example-utils/example-up-client-foo/src/up_client_foo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,8 @@ impl UTransport for UPClientFoo {
async fn register_listener(
&self,
topic: UUri,
listener: &Arc<dyn UListener>,
listener: Arc<dyn UListener>,
) -> Result<(), UStatus> {
let listener = listener.clone();
println!("{}: registering listener for: {topic:?}", &self.name);

return if topic.resource.is_none() && topic.entity.is_none() {
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ pub async fn run_client(
let client = UPClientFoo::new(&name, rx, tx).await;

let register_res = client
.register_listener(my_client_uuri.clone(), &listener)
.register_listener(my_client_uuri.clone(), listener)
.await;
let Ok(_registration_string) = register_res else {
panic!("Unable to register!");
Expand Down
2 changes: 1 addition & 1 deletion up-streamer/src/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const ROUTEFN_NEW_TAG: &str = "new():";
/// # async fn register_listener(
/// # &self,
/// # topic: UUri,
/// # _listener: &Arc<dyn UListener>,
/// # _listener: Arc<dyn UListener>,
/// # ) -> Result<(), UStatus> {
/// # println!("UPClientFoo: registering topic: {:?}", topic);
/// # let uuid = UUIDBuilder::build();
Expand Down
9 changes: 3 additions & 6 deletions up-streamer/src/ustreamer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ impl UStreamer {
r#in.transport
.lock()
.await
.register_listener(
Self::uauthority_to_uuri(out.authority),
&forwarding_listener,
)
.register_listener(Self::uauthority_to_uuri(out.authority), forwarding_listener)
.await
}
}
Expand Down Expand Up @@ -158,7 +155,7 @@ mod tests {
async fn register_listener(
&self,
topic: UUri,
_listener: &Arc<dyn UListener>,
_listener: Arc<dyn UListener>,
) -> Result<(), UStatus> {
println!("UPClientFoo: registering topic: {:?}", topic);
Ok(())
Expand Down Expand Up @@ -189,7 +186,7 @@ mod tests {
async fn register_listener(
&self,
topic: UUri,
_listener: &Arc<dyn UListener>,
_listener: Arc<dyn UListener>,
) -> Result<(), UStatus> {
println!("UPClientBar: registering topic: {:?}", topic);
Ok(())
Expand Down

0 comments on commit ec6ff04

Please sign in to comment.