pub struct StreamKey(/* private fields */);Expand description
The identifier of an event stream, as the store keys it: raw bytes.
The store is byte-level — at append/read it needs only a stream’s key
bytes and a label for diagnostics, never a domain aggregate identity.
So the byte-level operations (RawEventStore::read_stream
/ append,
export_stream,
list_streams, and the
import target) speak StreamKey,
not the kernel’s Id — honestly separating “a stream key” from
“a domain identity” (issue #245). A consumer’s typed domain id lives at the
repository layer; the repository translates it to a StreamKey (its job).
Like the wire-field newtypes in value (EventType,
Payload, Metadata), StreamKey is a Bytes-backed newtype — so a
stream key can never be confused with a payload or metadata buffer, and it
carries a Display the raw bytes cannot. A non-UTF-8 id
round-trips losslessly (unlike the former from_utf8_lossy reconstruction).
Implementations§
Source§impl StreamKey
impl StreamKey
Sourcepub fn from_bytes(bytes: impl Into<Bytes>) -> Self
pub fn from_bytes(bytes: impl Into<Bytes>) -> Self
Build a StreamKey from any owned byte source (zero-copy for Bytes /
Vec<u8> / String / &'static slices and strs).
Sourcepub fn from_slice(bytes: &[u8]) -> Self
pub fn from_slice(bytes: &[u8]) -> Self
Build a StreamKey by copying a borrowed byte slice — the convenient
shape for an import route (Fn(&[u8]) -> StreamKey), for translating a
domain id.as_ref() at the repository boundary, or for any &[u8] key.
Sourcepub fn into_bytes(self) -> Bytes
pub fn into_bytes(self) -> Bytes
Consume into the backing Bytes (zero-copy).
Trait Implementations§
Source§impl Display for StreamKey
The string when the bytes are valid UTF-8, else 0x… lowercase hex —
faithful for binary ids, readable for the common string id, always
unambiguous.
impl Display for StreamKey
The string when the bytes are valid UTF-8, else 0x… lowercase hex —
faithful for binary ids, readable for the common string id, always
unambiguous.
impl Eq for StreamKey
impl StructuralPartialEq for StreamKey
Auto Trait Implementations§
impl !Freeze for StreamKey
impl RefUnwindSafe for StreamKey
impl Send for StreamKey
impl Sync for StreamKey
impl Unpin for StreamKey
impl UnsafeUnpin for StreamKey
impl UnwindSafe for StreamKey
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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.