Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename KeyExpr::from_boxed_string_unchecked to KeyExpr::from_boxed_str_unchecked #1288

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions commons/zenoh-keyexpr/src/key_expr/owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ impl OwnedKeyExpr {
/// Key Expressions must follow some rules to be accepted by a Zenoh network.
/// Messages addressed with invalid key expressions will be dropped.
pub unsafe fn from_string_unchecked(s: String) -> Self {
Self::from_boxed_string_unchecked(s.into_boxed_str())
Self::from_boxed_str_unchecked(s.into_boxed_str())
}
/// Constructs an OwnedKeyExpr without checking [`keyexpr`]'s invariants
/// # Safety
/// Key Expressions must follow some rules to be accepted by a Zenoh network.
/// Messages addressed with invalid key expressions will be dropped.
pub unsafe fn from_boxed_string_unchecked(s: Box<str>) -> Self {
pub unsafe fn from_boxed_str_unchecked(s: Box<str>) -> Self {
OwnedKeyExpr(s.into())
}
}
Expand Down
8 changes: 4 additions & 4 deletions zenoh/src/api/key_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ impl KeyExpr<'static> {
/// # Safety
/// Key Expressions must follow some rules to be accepted by a Zenoh network.
/// Messages addressed with invalid key expressions will be dropped.
pub unsafe fn from_boxed_string_unchecked(s: Box<str>) -> Self {
Self(KeyExprInner::Owned(
OwnedKeyExpr::from_boxed_string_unchecked(s),
))
pub unsafe fn from_boxed_str_unchecked(s: Box<str>) -> Self {
Self(KeyExprInner::Owned(OwnedKeyExpr::from_boxed_str_unchecked(
s,
)))
}
}
impl<'a> KeyExpr<'a> {
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/api/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ pub(crate) enum Resource {
impl Resource {
pub(crate) fn new(name: Box<str>) -> Self {
if keyexpr::new(name.as_ref()).is_ok() {
Self::for_keyexpr(unsafe { OwnedKeyExpr::from_boxed_string_unchecked(name) })
Self::for_keyexpr(unsafe { OwnedKeyExpr::from_boxed_str_unchecked(name) })
} else {
Self::Prefix { prefix: name }
}
Expand Down