pub struct HttpTriggerRoute {
pub function_name: String,
pub method: String,
pub path: String,
pub requires_auth: bool,
}Expand description
Route for an HTTP trigger.
Defines a function that handles requests for a specific HTTP method and path.
§Execution
When a request matches this route, the function is invoked with an EventPayload
containing the request data (method, path, headers, body, params, query).
The function returns an HTTP response (status, headers, body).
Fields§
§function_name: StringName of the function to invoke.
method: StringHTTP method (GET, POST, etc.).
path: StringPath pattern (e.g., “/users/:id”).
requires_auth: boolWhether authentication is required.
Implementations§
Source§impl HttpTriggerRoute
impl HttpTriggerRoute
Sourcepub fn new(function_name: &str, method: &str, path: &str) -> Self
pub fn new(function_name: &str, method: &str, path: &str) -> Self
Create a new HTTP trigger route.
Sourcepub const fn without_auth(self) -> Self
pub const fn without_auth(self) -> Self
Builder method to not require authentication.
Sourcepub fn matches(&self, method: &str, path: &str) -> bool
pub fn matches(&self, method: &str, path: &str) -> bool
Check if this route matches the given method and path.
Sourcepub fn pattern_matches(&self, request_path: &str) -> bool
pub fn pattern_matches(&self, request_path: &str) -> bool
Check if this route’s path pattern matches a request path.
Simple pattern matching: exact match or * for variable segments.
Trait Implementations§
Source§impl Clone for HttpTriggerRoute
impl Clone for HttpTriggerRoute
Source§fn clone(&self) -> HttpTriggerRoute
fn clone(&self) -> HttpTriggerRoute
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 HttpTriggerRoute
impl RefUnwindSafe for HttpTriggerRoute
impl Send for HttpTriggerRoute
impl Sync for HttpTriggerRoute
impl Unpin for HttpTriggerRoute
impl UnsafeUnpin for HttpTriggerRoute
impl UnwindSafe for HttpTriggerRoute
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