pub struct StreamName(/* private fields */);Expand description
The name of a stream: what goes into the URL, and what a person reads in the relay’s listing.
One to MAX_NAME_LEN characters, lowercase ASCII letters, digits, -,
_ and ., starting with a letter or a digit. Narrow on purpose: a name
travels in a URL path, in a log line and in a file listing, and each of
those has its own idea of what is special. Widening the set later breaks
nobody; narrowing it would.
The relay sees names - they are not sealed. A name that says more than it
should (bank-passwords) says it to whoever runs the relay.
use efema_proto::StreamName;
assert!("notes".parse::<StreamName>().is_ok());
assert!("vault.2026-10".parse::<StreamName>().is_ok());
assert!("Notes".parse::<StreamName>().is_err());
assert!("-notes".parse::<StreamName>().is_err());
assert!("a/b".parse::<StreamName>().is_err());Implementations§
Trait Implementations§
Source§impl AsRef<str> for StreamName
impl AsRef<str> for StreamName
Source§impl Clone for StreamName
impl Clone for StreamName
Source§impl Debug for StreamName
impl Debug for StreamName
Source§impl<'b, C> Decode<'b, C> for StreamName
impl<'b, C> Decode<'b, C> for StreamName
Source§impl Display for StreamName
impl Display for StreamName
Source§impl<C> Encode<C> for StreamName
impl<C> Encode<C> for StreamName
impl Eq for StreamName
Source§impl FromStr for StreamName
impl FromStr for StreamName
Source§impl Hash for StreamName
impl Hash for StreamName
Source§impl Ord for StreamName
impl Ord for StreamName
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for StreamName
impl PartialEq for StreamName
Source§impl PartialOrd for StreamName
impl PartialOrd for StreamName
impl StructuralPartialEq for StreamName
Auto Trait Implementations§
impl Freeze for StreamName
impl RefUnwindSafe for StreamName
impl Send for StreamName
impl Sync for StreamName
impl Unpin for StreamName
impl UnsafeUnpin for StreamName
impl UnwindSafe for StreamName
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more