pub struct GenericOutput {
pub data: Value,
}
Expand description
Represents a generic output binding.
The following binding attributes are supported:
Name | Description |
---|---|
type | The binding type. |
name | The 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§
Source§impl Clone for GenericOutput
impl Clone for GenericOutput
Source§fn clone(&self) -> GenericOutput
fn clone(&self) -> GenericOutput
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for GenericOutput
impl Debug for GenericOutput
Source§impl From<&str> for GenericOutput
impl From<&str> for GenericOutput
Source§impl From<String> for GenericOutput
impl From<String> for GenericOutput
Source§impl From<Value> for GenericOutput
impl From<Value> for GenericOutput
Source§impl From<f64> for GenericOutput
impl From<f64> for GenericOutput
Auto Trait Implementations§
impl Freeze for GenericOutput
impl RefUnwindSafe for GenericOutput
impl Send for GenericOutput
impl Sync for GenericOutput
impl Unpin for GenericOutput
impl UnwindSafe for GenericOutput
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request