pub struct StreamSegment { /* private fields */ }Expand description
Builder for streaming segment metadata.
Manages session/segment IDs and auto-incrementing sequence numbers for real-time streaming patterns (voice, video, sensor streams).
Implementations§
Source§impl StreamSegment
impl StreamSegment
Sourcepub fn with_session_id(session_id: String) -> Self
pub fn with_session_id(session_id: String) -> Self
Start a new session with an explicit session ID.
Sourcepub fn next_segment(&mut self) -> i64
pub fn next_segment(&mut self) -> i64
Advance to a new segment (resets seq to 0). Returns the new segment_id.
Sourcepub fn chunk(&mut self, fin: bool) -> MetadataParameters
pub fn chunk(&mut self, fin: bool) -> MetadataParameters
Build metadata parameters for a chunk. Auto-increments seq.
Sourcepub fn flush(&mut self) -> MetadataParameters
pub fn flush(&mut self) -> MetadataParameters
Build metadata for a flush message (new segment, discards older queued data).
Advances to a new segment, then emits a chunk with flush=true and
fin=false. The prior segment ends without a fin=true signal – this
is intentional for interruption semantics (the old data is being
discarded, not completed).
Note: flush discards all queued messages on the receiver’s input
regardless of session_id. Do not multiplex independent sessions on a
single DataId when using flush.
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Returns the session ID.
Sourcepub fn segment_id(&self) -> i64
pub fn segment_id(&self) -> i64
Returns the current segment ID.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StreamSegment
impl RefUnwindSafe for StreamSegment
impl Send for StreamSegment
impl Sync for StreamSegment
impl Unpin for StreamSegment
impl UnsafeUnpin for StreamSegment
impl UnwindSafe for StreamSegment
Blanket Implementations§
Source§impl<Source> AccessAs for Source
impl<Source> AccessAs for Source
impl<T> Allocation for T
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request