Struct worker::Queue

source ·
pub struct Queue(/* private fields */);

Implementations§

source§

impl Queue

source

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?;
source

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.

source

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?;
source

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 AsRef<JsValue> for Queue

source§

fn as_ref(&self) -> &JsValue

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for Queue

source§

fn clone(&self) -> Queue

Returns a copy 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 EnvBinding for Queue

source§

const TYPE_NAME: &'static str = "WorkerQueue"

source§

fn get(val: JsValue) -> Result<Self>

source§

impl From<Queue> for JsValue

source§

fn from(queue: Queue) -> Self

Converts to this type from the input type.
source§

impl JsCast for Queue

source§

fn instanceof(val: &JsValue) -> bool

Performs a dynamic instanceof check to see whether the JsValue provided is an instance of this type. Read more
source§

fn unchecked_from_js(val: JsValue) -> Self

Performs a zero-cost unchecked conversion from a JsValue into an instance of Self Read more
source§

fn unchecked_from_js_ref(val: &JsValue) -> &Self

Performs a zero-cost unchecked conversion from a &JsValue into an instance of &Self. Read more
source§

fn has_type<T>(&self) -> bool
where T: JsCast,

Test whether this JS value has a type T. Read more
source§

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 more
source§

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 more
source§

fn unchecked_into<T>(self) -> T
where T: JsCast,

Performs a zero-cost unchecked cast into the specified type. Read more
source§

fn unchecked_ref<T>(&self) -> &T
where T: JsCast,

Performs a zero-cost unchecked cast into a reference to the specified type. Read more
source§

fn is_instance_of<T>(&self) -> bool
where T: JsCast,

Test whether this JS value is an instance of the type T. Read more
source§

fn is_type_of(val: &JsValue) -> bool

Performs a dynamic check to see whether the JsValue provided is a value of this type. Read more
source§

impl Send for Queue

source§

impl Sync for Queue

Auto Trait Implementations§

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more