pub struct Queue(/* private fields */);
Implementations§
source§impl Queue
impl Queue
sourcepub async fn send<T, U: Into<SendMessage<T>>>(&self, message: U) -> Result<()>where
T: Serialize,
pub async fn send<T, U: Into<SendMessage<T>>>(&self, message: U) -> Result<()>where
T: Serialize,
Sends a message to the Queue.
Accepts a struct that is serializable
.
If message options are needed use the MessageBuilder
to create the message.
§Example
#[derive(Serialize)]
pub struct MyMessage {
my_data: u32,
}
queue.send(MyMessage{ my_data: 1}).await?;
sourcepub async fn send_raw<T: Into<SendMessage<JsValue>>>(
&self,
message: T
) -> Result<()>
pub async fn send_raw<T: Into<SendMessage<JsValue>>>( &self, message: T ) -> Result<()>
Sends a raw JsValue
to the Queue.
Use the RawMessageBuilder
to create the message.
sourcepub async fn send_batch<T: Serialize, U: Into<BatchSendMessage<T>>>(
&self,
messages: U
) -> Result<()>
pub async fn send_batch<T: Serialize, U: Into<BatchSendMessage<T>>>( &self, messages: U ) -> Result<()>
Sends a batch of messages to the Queue.
Accepts an iterator that produces structs that are serializable
.
If message options are needed use the BatchMessageBuilder
to create the batch.
§Example
#[derive(Serialize)]
pub struct MyMessage {
my_data: u32,
}
queue.send_batch(vec![MyMessage{ my_data: 1}]).await?;
sourcepub async fn send_raw_batch<T: Into<BatchSendMessage<JsValue>>>(
&self,
messages: T
) -> Result<()>
pub async fn send_raw_batch<T: Into<BatchSendMessage<JsValue>>>( &self, messages: T ) -> Result<()>
Sends a batch of raw messages to the Queue.
Accepts an iterator that produces structs that are serializable
.
If message options are needed use the BatchMessageBuilder
to create the batch.
Trait Implementations§
source§impl EnvBinding for Queue
impl EnvBinding for Queue
source§impl JsCast for Queue
impl JsCast for Queue
source§fn instanceof(val: &JsValue) -> bool
fn instanceof(val: &JsValue) -> bool
Performs a dynamic
instanceof
check to see whether the JsValue
provided is an instance of this type. Read moresource§fn unchecked_from_js(val: JsValue) -> Self
fn unchecked_from_js(val: JsValue) -> Self
source§fn unchecked_from_js_ref(val: &JsValue) -> &Self
fn unchecked_from_js_ref(val: &JsValue) -> &Self
source§fn has_type<T>(&self) -> boolwhere
T: JsCast,
fn has_type<T>(&self) -> boolwhere
T: JsCast,
Test whether this JS value has a type
T
. Read moresource§fn dyn_into<T>(self) -> Result<T, Self>where
T: JsCast,
fn dyn_into<T>(self) -> Result<T, Self>where
T: JsCast,
Performs a dynamic cast (checked at runtime) of this value into the
target type
T
. Read moresource§fn dyn_ref<T>(&self) -> Option<&T>where
T: JsCast,
fn dyn_ref<T>(&self) -> Option<&T>where
T: JsCast,
Performs a dynamic cast (checked at runtime) of this value into the
target type
T
. Read moresource§fn unchecked_into<T>(self) -> Twhere
T: JsCast,
fn unchecked_into<T>(self) -> Twhere
T: JsCast,
Performs a zero-cost unchecked cast into the specified type. Read more
source§fn unchecked_ref<T>(&self) -> &Twhere
T: JsCast,
fn unchecked_ref<T>(&self) -> &Twhere
T: JsCast,
Performs a zero-cost unchecked cast into a reference to the specified
type. Read more
impl Send for Queue
impl Sync for Queue
Auto Trait Implementations§
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
Mutably borrows from an owned value. Read more