Struct azure_functions::Context[][src]

pub struct Context<'a> { /* fields omitted */ }

Represents context about an Azure Function invocation.

Examples

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

#[func]
#[binding(name = "req", auth_level = "anonymous")]
pub fn log_context(context: &Context, req: &HttpRequest) {
    info!("Context: {:?}", context);
}

Methods

impl<'a> Context<'a>
[src]

Gets the invocation identifier for the current Azure Function.

Examples

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

#[func]
#[binding(name = "req", auth_level = "anonymous")]
pub fn log_context(context: &Context, req: &HttpRequest) {
    info!("Invocation ID: {}", context.invocation_id());
}

Gets the function identifier for the current Azure Function.

Examples

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

#[func]
#[binding(name = "req", auth_level = "anonymous")]
pub fn log_context(context: &Context, req: &HttpRequest) {
    info!("Function ID: {}", context.function_id());
}

Gets the name of the current Azure Function.

Examples

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

#[func]
#[binding(name = "req", auth_level = "anonymous")]
pub fn log_context(context: &Context, req: &HttpRequest) {
    info!("Function name: {}", context.function_name());
}

Gets the directory for the current Azure Function.

Examples

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

#[func]
#[binding(name = "req", auth_level = "anonymous")]
pub fn log_context(context: &Context, req: &HttpRequest) {
    info!("Function directory: {}", context.function_directory().unwrap().display());
}

Gets the directory for the current Azure Function Application.

Examples

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

#[func]
#[binding(name = "req", auth_level = "anonymous")]
pub fn log_context(context: &Context, req: &HttpRequest) {
    info!("App directory: {}", context.app_directory().unwrap().display());
}

Trait Implementations

impl<'a> Debug for Context<'a>
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'a> Send for Context<'a>

impl<'a> Sync for Context<'a>