[−][src]Struct rocket_lamb::RocketHandlerBuilder
A builder to create and configure a RocketHandler.
Methods
impl RocketHandlerBuilder
[src]
pub fn new(rocket: Rocket) -> RocketHandlerBuilder
[src]
Create a new RocketHandlerBuilder
. Alternatively, you can use rocket.lambda().
Example
use rocket_lamb::RocketHandlerBuilder; let builder = RocketHandlerBuilder::new(rocket::ignite());
pub fn into_handler(self) -> RocketHandler
[src]
Creates a new RocketHandler
from an instance of Rocket
, which can be passed to the lambda_http::lambda! macro.
Alternatively, you can use the launch() method.
Example
use rocket_lamb::RocketExt; use lambda_http::lambda; let handler = rocket::ignite().lambda().into_handler(); lambda!(handler);
pub fn launch(self) -> !
[src]
Starts handling Lambda events by polling for events using Lambda's Runtime APIs.
This function does not return, as it will loop forever (unless it panics).
Panics
This panics if the required Lambda runtime environment variables are not set, or if the Rocket
used to create the builder was misconfigured.
Example
use rocket_lamb::RocketExt; use lambda_http::lambda; rocket::ignite().lambda().launch();
pub fn get_default_response_type(&self) -> ResponseType
[src]
Gets the default ResponseType
, which is used for any responses that have not had their Content-Type overriden with response_type.
Example
use rocket_lamb::{RocketExt, ResponseType}; let builder = rocket::ignite().lambda(); assert_eq!(builder.get_default_response_type(), ResponseType::Auto); assert_eq!(builder.get_response_type("text/plain"), ResponseType::Auto);
pub fn default_response_type(self, response_type: ResponseType) -> Self
[src]
Sets the default ResponseType
, which is used for any responses that have not had their Content-Type overriden with response_type.
Example
use rocket_lamb::{RocketExt, ResponseType}; let builder = rocket::ignite() .lambda() .default_response_type(ResponseType::Binary); assert_eq!(builder.get_default_response_type(), ResponseType::Binary); assert_eq!(builder.get_response_type("text/plain"), ResponseType::Binary);
pub fn get_response_type(&self, content_type: &str) -> ResponseType
[src]
Gets the configured ResponseType
for responses with the given Content-Type header.
content_type
values are treated case-insensitively.
Example
use rocket_lamb::{RocketExt, ResponseType}; let builder = rocket::ignite() .lambda() .response_type("TEXT/PLAIN", ResponseType::Text); assert_eq!(builder.get_response_type("text/plain"), ResponseType::Text); assert_eq!(builder.get_response_type("application/json"), ResponseType::Auto);
pub fn response_type(
self,
content_type: &str,
response_type: ResponseType
) -> Self
[src]
self,
content_type: &str,
response_type: ResponseType
) -> Self
Sets the ResponseType
for responses with the given Content-Type header.
content_type
values are treated case-insensitively.
Example
use rocket_lamb::{RocketExt, ResponseType}; let builder = rocket::ignite() .lambda() .response_type("TEXT/PLAIN", ResponseType::Text); assert_eq!(builder.get_response_type("text/plain"), ResponseType::Text); assert_eq!(builder.get_response_type("application/json"), ResponseType::Auto);
pub fn base_path_behaviour(self, setting: BasePathBehaviour) -> Self
[src]
Determines whether the API Gateway base path is included in the URL processed by Rocket.
The default is RemountAndInclude
.
When calling the API using the default API Gateway URL e.g.
{api-id}.execute-api.{region}.amazonaws.com/{stage}/
, the base path will be /{stage}
.
When calling the API using an API Gateway custom domain, a base path may be configured
on the custom domain.
This has no effect for Application Load Balancer requests, as these will never have a base path.
The possible values are:
RemountAndInclude
- Includes the base bath in the URL. The first request received will be used to determine the base path, and all mounted routes will be cloned and re-mounted at the base path.Include
- Includes the base bath in the URL. You must ensure that theRocket
's routes have been mounted at the expected base path.Exclude
- Excludes the base bath from the URL. The URL processed by Rocket may not match the full path of the original client, which may cause absolute URLs in responses (e.g. in theLocation
response header for redirects) to not behave as expected.
Example
use rocket_lamb::{BasePathBehaviour, RocketExt}; let builder = rocket::ignite() .lambda() .base_path_behaviour(BasePathBehaviour::Exclude);
Auto Trait Implementations
impl Send for RocketHandlerBuilder
impl Unpin for RocketHandlerBuilder
impl Sync for RocketHandlerBuilder
impl !UnwindSafe for RocketHandlerBuilder
impl !RefUnwindSafe for RocketHandlerBuilder
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Typeable for T where
T: Any,
T: Any,
impl<T> IntoCollection<T> for T
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
A: Array<Item = T>,
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
A: Array<Item = U>,
F: FnMut(T) -> U,
A: Array<Item = U>,
F: FnMut(T) -> U,
impl<T, I> AsResult<T, I> for T where
I: Input,
I: Input,