pub struct GenericTrigger {
pub data: Value,
pub metadata: HashMap<String, Value>,
}
Expand description
Represents a generic trigger 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 GenericTrigger
binding instead of a CosmosDbTrigger
binding:
use azure_functions::{bindings::GenericTrigger, func, generic::Value};
use log::info;
#[func]
#[binding(
type = "cosmosDBTrigger",
name = "trigger",
connectionStringSetting = "connection",
databaseName = "exampledb",
collectionName = "documents",
createLeaseCollectionIfNotExists = true
)]
pub fn log_documents(trigger: GenericTrigger) {
match trigger.data {
Value::Json(v) => {
info!("{}", v);
}
_ => panic!("expected JSON for Cosmos DB trigger data"),
}
}
Fields§
§data: Value
The trigger binding data.
metadata: HashMap<String, Value>
The trigger metadata.
Trait Implementations§
Source§impl Clone for GenericTrigger
impl Clone for GenericTrigger
Source§fn clone(&self) -> GenericTrigger
fn clone(&self) -> GenericTrigger
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 moreAuto Trait Implementations§
impl Freeze for GenericTrigger
impl RefUnwindSafe for GenericTrigger
impl Send for GenericTrigger
impl Sync for GenericTrigger
impl Unpin for GenericTrigger
impl UnwindSafe for GenericTrigger
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