pub enum OpenStreamFrame {
Start {
content_type: Option<String>,
},
Accept,
Chunk {
chunk_index: u64,
data: String,
},
Ping {
nonce: String,
},
Pong {
nonce: String,
},
Close {
last_chunk_index: Option<u64>,
},
Abort {
reason: Option<String>,
},
}Expand description
A CEP-41 open-stream frame (the cvm object).
Internally tagged on frameType. The constant cvm.type ("open-stream")
is handled separately by to_cvm_value /
from_cvm_value rather than encoded as an enum
field, exactly mirroring CEP-22’s oversized_transfer/frame.rs.
Variants§
Start
Opens a stream. Carries only optional application-defined advisory metadata; receivers MUST NOT depend on it for stream correctness.
Fields
Accept
Reader handshake acknowledgement, sent only in reply to an inbound start.
Chunk
One ordered payload fragment of the stream.
Fields
Ping
Keepalive probe; the peer must echo the nonce in a pong.
Pong
Keepalive response echoing a prior ping nonce.
Close
Closes the stream gracefully (terminal). Declares the final chunk index when any chunks were emitted, so the reader can verify completeness.
Fields
Abort
Terminates the stream early (terminal).
Implementations§
Source§impl OpenStreamFrame
impl OpenStreamFrame
Sourcepub fn frame_type(&self) -> &'static str
pub fn frame_type(&self) -> &'static str
Returns the frameType discriminator string for this frame.
Sourcepub fn to_cvm_value(&self) -> Result<Value, Error>
pub fn to_cvm_value(&self) -> Result<Value, Error>
Serialize this frame into a cvm object Value, injecting the constant
type discriminator ("open-stream").
Sourcepub fn from_cvm_value(value: &Value) -> Option<Self>
pub fn from_cvm_value(value: &Value) -> Option<Self>
Parse a cvm object Value into a typed frame, verifying the type
discriminator. Returns None when value is not an open-stream frame or
fails to parse.
Sourcepub fn is_frame_value(value: &Value) -> bool
pub fn is_frame_value(value: &Value) -> bool
Returns true when value structurally looks like an open-stream frame
(type == "open-stream" and a string frameType).
Mirrors the TS isOpenStreamFrame structural narrowing.
Sourcepub fn into_progress_notification(
&self,
progress_token: &str,
progress: u64,
message: Option<&str>,
) -> Result<JsonRpcNotification, Error>
pub fn into_progress_notification( &self, progress_token: &str, progress: u64, message: Option<&str>, ) -> Result<JsonRpcNotification, Error>
Wrap this frame in a notifications/progress JsonRpcNotification.
Builds the outer params with progressToken, progress, an optional
human-readable message (non-normative UX), and the cvm frame. The
token is always emitted as a JSON string, even when the originating
request carried a numeric one (matching the TS SDK’s
String(progressToken)); see
progress_token_string.
Trait Implementations§
Source§impl Clone for OpenStreamFrame
impl Clone for OpenStreamFrame
Source§fn clone(&self) -> OpenStreamFrame
fn clone(&self) -> OpenStreamFrame
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OpenStreamFrame
impl Debug for OpenStreamFrame
Source§impl<'de> Deserialize<'de> for OpenStreamFrame
impl<'de> Deserialize<'de> for OpenStreamFrame
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for OpenStreamFrame
Source§impl PartialEq for OpenStreamFrame
impl PartialEq for OpenStreamFrame
Source§impl Serialize for OpenStreamFrame
impl Serialize for OpenStreamFrame
impl StructuralPartialEq for OpenStreamFrame
Auto Trait Implementations§
impl Freeze for OpenStreamFrame
impl RefUnwindSafe for OpenStreamFrame
impl Send for OpenStreamFrame
impl Sync for OpenStreamFrame
impl Unpin for OpenStreamFrame
impl UnsafeUnpin for OpenStreamFrame
impl UnwindSafe for OpenStreamFrame
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 more