[][src]Struct azure_functions::bindings::QueueMessage

pub struct QueueMessage(_);

Represents an Azure Storage Queue message output binding.

The following binding attributes are supported:

NameDescription
nameThe name of the parameter being bound.
queue_nameThe name of the queue.
connectionThe name of an app setting that contains the Azure Storage connection string to use for this binding. Defaults to the AzureWebJobsStorage.

Examples

Creating a queue message from a string:

use azure_functions::bindings::{HttpRequest, QueueMessage};
use azure_functions::func;

#[func]
#[binding(name = "output1", queue_name = "example")]
pub fn example(_req: HttpRequest) -> ((), QueueMessage) {
    ((), "Hello world!".into())
}

Creating a queue message from a JSON value (see the json! macro from the serde_json crate):

use azure_functions::bindings::{HttpRequest, QueueMessage};
use azure_functions::func;
use serde_json::json;

#[func]
#[binding(name = "output1", queue_name = "example")]
pub fn example(_req: HttpRequest) -> ((), QueueMessage) {
    ((), json!({ "hello": "world" }).into())
}

Creating a queue message from a sequence of bytes:

use azure_functions::bindings::{HttpRequest, QueueMessage};
use azure_functions::func;
use serde_json::json;

#[func]
#[binding(name = "output1", queue_name = "example")]
pub fn example(_req: HttpRequest) -> ((), QueueMessage) {
    ((), [1, 2, 3][..].into())
}

Methods

impl QueueMessage[src]

pub fn as_str(&self) -> Option<&str>[src]

Gets the content of the message as a string.

Returns None if there is no valid string representation of the message.

pub fn as_bytes(&self) -> &[u8][src]

Gets the content of the message as a slice of bytes.

pub fn as_json<'b, T>(&'b self) -> Result<T> where
    T: Deserialize<'b>, 
[src]

Deserializes the message as JSON to the requested type.

Trait Implementations

impl Into<String> for QueueMessage[src]

impl Into<Value> for QueueMessage[src]

impl Into<Vec<u8>> for QueueMessage[src]

impl<'a> Into<Body<'a>> for QueueMessage[src]

impl<'a> From<&'a str> for QueueMessage[src]

impl From<String> for QueueMessage[src]

impl<'_> From<&'_ Value> for QueueMessage[src]

impl From<Value> for QueueMessage[src]

impl<'a> From<&'a [u8]> for QueueMessage[src]

impl From<Vec<u8>> for QueueMessage[src]

impl Clone for QueueMessage[src]

impl Display for QueueMessage[src]

impl Debug for QueueMessage[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> IntoRequest<T> for T[src]

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