Skip to content

Commit

Permalink
refactor: use Into bound for KeyExpr::with_parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
wyfo committed Apr 25, 2024
1 parent d9b65a7 commit e7350a4
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions zenoh/src/key_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ use zenoh_protocol::{
};
use zenoh_result::ZResult;

use crate::{net::primitives::Primitives, prelude::Selector, Session, Undeclarable};
use crate::{
net::primitives::Primitives, prelude::Selector, selector::Parameters, Session, Undeclarable,
};

#[derive(Clone, Debug)]
pub(crate) enum KeyExprInner<'a> {
Expand Down Expand Up @@ -302,17 +304,10 @@ impl<'a> KeyExpr<'a> {
}
}

pub fn with_parameters(self, selector: &'a str) -> Selector<'a> {
Selector {
key_expr: self,
parameters: selector.into(),
}
}

pub fn with_owned_parameters(self, selector: String) -> Selector<'a> {
pub fn with_parameters<P: Into<Parameters<'a>>>(self, parameters: P) -> Selector<'a> {
Selector {
key_expr: self,
parameters: selector.into(),
parameters: parameters.into(),
}
}
}
Expand Down

0 comments on commit e7350a4

Please sign in to comment.