Skip to content

Commit

Permalink
Fix no_std
Browse files Browse the repository at this point in the history
  • Loading branch information
Mallets committed Feb 16, 2024
1 parent 3f901b5 commit cbda61a
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions commons/zenoh-protocol/src/core/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
//
use crate::core::CowStr;
use alloc::{borrow::Cow, string::String};
use core::fmt::{self, Debug};
use core::{
fmt::{self, Debug},
write,
};
use zenoh_result::{bail, ZResult};

pub type EncodingPrefix = u8;
Expand Down Expand Up @@ -120,14 +123,7 @@ impl Encoding {
where
IntoCowStr: Into<Cow<'static, str>> + AsRef<str>,
{
let suffix: Cow<'static, str> = suffix.into();
if suffix.as_bytes().len() > EncodingPrefix::MAX as usize {
bail!("Suffix length is limited to 255 characters")
}
Ok(Self {
prefix,
suffix: suffix.into(),
})
Self::exact(prefix).with_suffix(suffix)
}

/// Sets the suffix of this encoding.
Expand Down

0 comments on commit cbda61a

Please sign in to comment.