Skip to main content

Frame

Struct Frame 

Source
#[non_exhaustive]
pub struct Frame { pub bytes: Vec<u8>, pub kind: FrameKind, pub seq: Option<u64>, pub frame_type: String, pub correlation_id: Option<String>, pub mode: StreamMode, }
Expand description

Single stream frame appended via append_frame (RFC-012 §3.3.0). Today’s FCALL takes the byte payload + frame_type + optional seq as discrete ARGV; Stage 0 collects them into a named type for trait signatures.

Round-7 follow-up (PR #145 → #146): extended with frame_type: String (the SDK-public free-form classifier — values like "delta", "log", "agent_step", "summary_token", "transcribe_line", "progress" — distinct from the coarse FrameKind enum) and correlation_id: Option<String> (the wire-level correlation_id ARGV, surfaced at the SDK as metadata: Option<&str>). Adding these lets ClaimedTask::append_frame forward through the trait without wire-parity regression.

frame_type is free-form and is what the backend writes into the Lua-side frame_type ARGV. FrameKind remains for typed classification at the trait surface; when callers populate only kind, the backend falls back to a stable encoding of the enum variant (see frame_kind_to_str in ff-backend-valkey).

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§bytes: Vec<u8>§kind: FrameKind§seq: Option<u64>

Optional monotonic sequence. Set by the caller when the stream protocol is sequence-bound; None lets the backend assign.

§frame_type: String

Free-form classifier written to the Lua-side frame_type ARGV. Empty string means “defer to FrameKind” — the backend substitutes the enum-variant encoding.

§correlation_id: Option<String>

Optional correlation id (wire correlation_id ARGV). None encodes as the empty string on the wire.

§mode: StreamMode

Durability mode for this frame (RFC-015 §1). Defaults to StreamMode::Durable for v1-caller parity — the field was added additively so pre-RFC-015 construction via Self::new / Self::with_seq sees Durable without code change.

Implementations§

Source§

impl Frame

Source

pub fn new(bytes: Vec<u8>, kind: FrameKind) -> Self

Construct a frame. seq defaults to None (backend-assigned); frame_type defaults to empty (backend falls back to FrameKind encoding); correlation_id defaults to None. Callers that need an explicit sequence use Frame::with_seq; callers on the SDK forwarder path populate frame_type + correlation_id via Frame::with_frame_type / Frame::with_correlation_id.

Source

pub fn with_seq(bytes: Vec<u8>, kind: FrameKind, seq: u64) -> Self

Construct a frame with an explicit monotonic sequence.

Source

pub fn with_mode(self, mode: StreamMode) -> Self

Builder-style setter for the RFC-015 durability StreamMode. Defaults to StreamMode::Durable (v1 parity) when unset.

Source

pub fn with_frame_type(self, frame_type: impl Into<String>) -> Self

Builder-style setter for the free-form frame_type classifier.

Source

pub fn with_correlation_id(self, correlation_id: impl Into<String>) -> Self

Builder-style setter for the optional correlation_id.

Trait Implementations§

Source§

impl Clone for Frame

Source§

fn clone(&self) -> Frame

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Frame

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Frame

Source§

fn eq(&self, other: &Frame) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Frame

Source§

impl StructuralPartialEq for Frame

Auto Trait Implementations§

§

impl Freeze for Frame

§

impl RefUnwindSafe for Frame

§

impl Send for Frame

§

impl Sync for Frame

§

impl Unpin for Frame

§

impl UnsafeUnpin for Frame

§

impl UnwindSafe for Frame

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.