#[non_exhaustive]pub struct StreamTextOptions {
pub topic: String,
pub attributes: HashMap<String, String>,
pub destination_identities: Vec<ParticipantIdentity>,
pub id: Option<String>,
pub operation_type: Option<OperationType>,
pub version: Option<i32>,
pub reply_to_stream_id: Option<String>,
pub attached_stream_ids: Vec<String>,
pub generated: Option<bool>,
pub sender_identity: Option<ParticipantIdentity>,
pub total_length: Option<u64>,
}Expand description
Options for stream_text, which never compresses or inlines content.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.topic: StringTopic the stream is published to.
attributes: HashMap<String, String>Attributes attached to the stream.
destination_identities: Vec<ParticipantIdentity>Recipients; an empty list delivers to all participants.
id: Option<String>Explicit stream id, or a new UUID per call when unspecified.
operation_type: Option<OperationType>Operation this text stream represents.
version: Option<i32>Version used to order updates to the same content.
reply_to_stream_id: Option<String>Id of the stream this text replies to.
attached_stream_ids: Vec<String>Ids of streams attached to this text.
generated: Option<bool>Whether the text was machine-generated.
sender_identity: Option<ParticipantIdentity>Identity attributed to the packets, or the sending participant when unspecified. Impersonating another identity requires the appropriate permission (e.g. agents).
total_length: Option<u64>Declared total byte length, when known. The receiver fails the stream on a mismatch.
Implementations§
Source§impl StreamTextOptions
impl StreamTextOptions
Sourcepub fn new_with_topic(topic: impl Into<String>) -> Self
pub fn new_with_topic(topic: impl Into<String>) -> Self
Creates options for the given topic. Use the with_* setters to customize them.
Sourcepub fn with_topic(self, topic: impl Into<String>) -> Self
pub fn with_topic(self, topic: impl Into<String>) -> Self
Sets the topic the stream is published to, accepting any value convertible to String.
Sourcepub fn with_attributes(self, attributes: HashMap<String, String>) -> Self
pub fn with_attributes(self, attributes: HashMap<String, String>) -> Self
Replaces all attributes attached to the stream.
Sourcepub fn with_attribute(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_attribute( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Adds a single attribute to the stream, overwriting any existing value for key.
Sourcepub fn with_destination_identities(
self,
destination_identities: Vec<ParticipantIdentity>,
) -> Self
pub fn with_destination_identities( self, destination_identities: Vec<ParticipantIdentity>, ) -> Self
Replaces the set of participant identities the stream is delivered to. An empty list delivers to all participants in the room.
Sourcepub fn with_destination_identity(
self,
identity: impl Into<ParticipantIdentity>,
) -> Self
pub fn with_destination_identity( self, identity: impl Into<ParticipantIdentity>, ) -> Self
Adds a single participant identity to the stream’s destinations.
Sourcepub fn with_id(self, id: impl Into<String>) -> Self
pub fn with_id(self, id: impl Into<String>) -> Self
Sets an explicit stream id. If unset, a new uuid is generated per call.
Sourcepub fn with_sender_identity(
self,
identity: impl Into<ParticipantIdentity>,
) -> Self
pub fn with_sender_identity( self, identity: impl Into<ParticipantIdentity>, ) -> Self
Sets the identity the stream’s packets are attributed to. Only participants with the appropriate permission (e.g. agents) may impersonate another identity.
Sourcepub fn with_operation_type(self, operation_type: OperationType) -> Self
pub fn with_operation_type(self, operation_type: OperationType) -> Self
Sets the operation this text stream represents (e.g. create or update).
Sourcepub fn with_version(self, version: i32) -> Self
pub fn with_version(self, version: i32) -> Self
Sets the version of the text, used to order updates to the same content.
Sourcepub fn with_reply_to_stream_id(
self,
reply_to_stream_id: impl Into<String>,
) -> Self
pub fn with_reply_to_stream_id( self, reply_to_stream_id: impl Into<String>, ) -> Self
Sets the id of the stream this text is a reply to.
Sourcepub fn with_attached_stream_ids(self, attached_stream_ids: Vec<String>) -> Self
pub fn with_attached_stream_ids(self, attached_stream_ids: Vec<String>) -> Self
Replaces the set of stream ids attached to this text (e.g. referenced files).
Sourcepub fn with_attached_stream_id(
self,
attached_stream_id: impl Into<String>,
) -> Self
pub fn with_attached_stream_id( self, attached_stream_id: impl Into<String>, ) -> Self
Adds a single attached stream id to this text.
Sourcepub fn with_generated(self, generated: bool) -> Self
pub fn with_generated(self, generated: bool) -> Self
Sets whether the text was machine-generated (e.g. by an agent).
Sourcepub fn with_total_length(self, total_length: u64) -> Self
pub fn with_total_length(self, total_length: u64) -> Self
Sets the total byte length of the payload, when known ahead of time.