[][src]Struct azure_functions::bindings::GenericOutput

pub struct GenericOutput {
    pub data: Value,
}

Represents a generic output binding.

The following binding attributes are supported:

NameDescription
typeThe binding type.
nameThe name of the parameter being bound.
*The additional binding attributes specific to the binding type. Supported value types are strings, booleans, and integers.

Examples

An example of using a GenericOutput binding instead of a CosmosDbDocument binding:

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

#[func]
#[binding(name = "req", route = "create/{id}")]
#[binding(
    type = "cosmosDB",
    name = "output1",
    connectionStringSetting = "connection",
    databaseName = "exampledb",
    collectionName = "documents",
    createIfNotExists = true
)]
pub fn create_document(req: HttpRequest) -> (HttpResponse, GenericOutput) {
    (
        "Document was created.".into(),
        json!({
            "id": req.route_params().get("id").unwrap(),
            "name": req.query_params().get("name").map_or("stranger", |x| x)
        })
        .into(),
    )
}

Fields

data: Value

The output binding data.

Trait Implementations

impl<'_> From<&'_ str> for GenericOutput[src]

impl From<String> for GenericOutput[src]

impl From<Value> for GenericOutput[src]

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

impl From<i64> for GenericOutput[src]

impl From<f64> for GenericOutput[src]

impl Clone for GenericOutput[src]

impl Debug for GenericOutput[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, 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>,