pub struct Blob(/* private fields */);
Expand description
Represents an Azure Storage blob input or output binding.
The following binding attributes are supported:
Name | Description |
---|---|
name | The name of the parameter being bound. |
path | The path to the blob. |
connection | The name of an app setting that contains the Storage connection string to use for this binding. Defaults to AzureWebJobsStorage . |
§Examples
Creating a blob from a string:
use azure_functions::bindings::{HttpRequest, Blob};
use azure_functions::func;
#[func]
#[binding(name = "output1", path = "example")]
pub fn create_blob(_req: HttpRequest) -> ((), Blob) {
((), "Hello world!".into())
}
Creating a blob from a JSON value (see the json! macro from the serde_json
crate):
use azure_functions::bindings::{HttpRequest, Blob};
use azure_functions::func;
use serde_json::json;
#[func]
#[binding(name = "output1", path = "example")]
pub fn create_blob(_req: HttpRequest) -> ((), Blob) {
((), json!({ "hello": "world!" }).into())
}
Creating a blob from a sequence of bytes:
use azure_functions::bindings::{HttpRequest, Blob};
use azure_functions::func;
#[func]
#[binding(name = "output1", path = "example")]
pub fn create_blob(_req: HttpRequest) -> ((), Blob) {
((), [1, 2, 3][..].into())
}
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Blob
impl RefUnwindSafe for Blob
impl Send for Blob
impl Sync for Blob
impl Unpin for Blob
impl UnwindSafe for Blob
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