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]
impl<'a> Context<'a>
pub fn invocation_id(&self) -> &str
[src]
pub fn invocation_id(&self) -> &str
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()); }
pub fn function_id(&self) -> &str
[src]
pub fn function_id(&self) -> &str
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()); }
pub fn function_name(&self) -> &str
[src]
pub fn function_name(&self) -> &str
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()); }
pub fn function_directory(&self) -> Option<PathBuf>
[src]
pub fn function_directory(&self) -> Option<PathBuf>
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()); }
pub fn app_directory(&self) -> Option<PathBuf>
[src]
pub fn app_directory(&self) -> Option<PathBuf>
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()); }