Skip to content

Commit

Permalink
Rename from_boxed_string_unchecked to from_boxed_str_unchecked (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzypixelz authored Jul 31, 2024
1 parent bcda8ec commit f394867
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
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

0 comments on commit f394867

Please sign in to comment.