#[non_exhaustive]pub struct SendByteOptions {
pub topic: String,
pub attributes: HashMap<String, String>,
pub destination_identities: Vec<ParticipantIdentity>,
pub id: Option<String>,
pub mime_type: Option<String>,
pub name: Option<String>,
pub sender_identity: Option<ParticipantIdentity>,
pub compress: Option<bool>,
pub on_progress: Option<StreamProgressCallback>,
}Expand description
Options for send_bytes and send_file.
See Self::on_progress for progress reporting semantics.
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.
mime_type: Option<String>MIME type describing the payload.
name: Option<String>Human-readable name; send_file defaults to the file name.
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).
compress: Option<bool>Whether to deflate-raw compress when all recipients support it. Defaults to true.
on_progress: Option<StreamProgressCallback>Byte sends report once after the complete send is acknowledged. Files report input bytes before compression, against the file size, after each chunk is sent or each encoder drain. Compressed progress can run ahead of chunks sent; the whole file is reported only after its last chunk was sent.
Implementations§
Source§impl SendByteOptions
impl SendByteOptions
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_mime_type(self, mime_type: impl Into<String>) -> Self
pub fn with_mime_type(self, mime_type: impl Into<String>) -> Self
Sets the MIME type describing the stream’s payload.
Sourcepub fn with_name(self, name: impl Into<String>) -> Self
pub fn with_name(self, name: impl Into<String>) -> Self
Sets a human-readable name for the stream (e.g. a file name).
Sourcepub fn with_compress(self, compress: bool) -> Self
pub fn with_compress(self, compress: bool) -> Self
Sets whether to deflate-raw compress when all recipients support it.
Defaults to true (compression opt-out).
Sourcepub fn with_on_progress(
self,
callback: impl Fn(StreamProgress) + Send + Sync + 'static,
) -> Self
pub fn with_on_progress( self, callback: impl Fn(StreamProgress) + Send + Sync + 'static, ) -> Self
Sets the progress callback; see Self::on_progress for reporting semantics.