pub struct EventType { /* private fields */ }Expand description
A validated event type name.
Invariants: valid UTF-8, length ≤ MAX_EVENT_TYPE_LEN.
Backed by Bytes; constructible from a &'static str literal at
zero allocation via from_static_str, or
from arbitrary Bytes via the validating
from_bytes.
Implementations§
Source§impl EventType
impl EventType
Sourcepub fn from_static_str(s: &'static str) -> Self
pub fn from_static_str(s: &'static str) -> Self
Construct from a &'static str literal. Infallible for valid
literals: &str is UTF-8 by Rust’s type system, and program-text
literals are bounded by the source file.
§Panics
Panics if s.len() > MAX_EVENT_TYPE_LEN. For string literals this
is a programmer error caught at first use; the runtime check
catches the Box::leak(String::from(runtime)) case that would
otherwise silently corrupt the wire encoding.
Sourcepub fn from_bytes(bytes: Bytes) -> Result<Self, ValueError>
pub fn from_bytes(bytes: Bytes) -> Result<Self, ValueError>
Construct from arbitrary bytes, validating UTF-8 and size cap.
§Errors
ValueError::EventTypeTooLongifbytes.len() > MAX_EVENT_TYPE_LEN.ValueError::EventTypeInvalidUtf8ifbytesis not valid UTF-8.
Sourcepub fn into_bytes(self) -> Bytes
pub fn into_bytes(self) -> Bytes
Take ownership of the inner Bytes (one Arc share, no copy).
Trait Implementations§
impl Eq for EventType
impl StructuralPartialEq for EventType
Auto Trait Implementations§
impl !Freeze for EventType
impl RefUnwindSafe for EventType
impl Send for EventType
impl Sync for EventType
impl Unpin for EventType
impl UnsafeUnpin for EventType
impl UnwindSafe for EventType
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.