pub struct MockLambdaRuntimeApiServer(/* private fields */);
Expand description
A mock server for the Lambda Runtime API.
Use Self::bind
to create a new server, and Self::serve
to start serving requests.
If you want to handle each connection manually, use Self::handle_next
.
If you want to forward requests to the real Lambda Runtime API, use Self::passthrough
.
§Examples
use aws_lambda_runtime_proxy::MockLambdaRuntimeApiServer;
let server = MockLambdaRuntimeApiServer::bind(3000).await.unwrap();
// proxy all requests to the real Lambda Runtime API
server.passthrough().await;
Implementations§
Source§impl MockLambdaRuntimeApiServer
impl MockLambdaRuntimeApiServer
Sourcepub async fn handle_next<ResBody, Fut>(
&self,
processor: impl Fn(Request<Incoming>) -> Fut + Send + Sync + 'static,
) -> Result<()>
pub async fn handle_next<ResBody, Fut>( &self, processor: impl Fn(Request<Incoming>) -> Fut + Send + Sync + 'static, ) -> Result<()>
Handle the next incoming connection with the provided processor.
Sourcepub async fn serve<ResBody, Fut>(
&self,
processor: impl Fn(Request<Incoming>) -> Fut + Send + Sync + Clone + 'static,
)
pub async fn serve<ResBody, Fut>( &self, processor: impl Fn(Request<Incoming>) -> Fut + Send + Sync + Clone + 'static, )
Block the current thread and handle connections with the processor in a loop.
Sourcepub async fn passthrough(&self)
pub async fn passthrough(&self)
Block the current thread and handle connections in a loop,
forwarding requests to a new LambdaRuntimeApiClient
, and responding with the client’s response.
Auto Trait Implementations§
impl !Freeze for MockLambdaRuntimeApiServer
impl RefUnwindSafe for MockLambdaRuntimeApiServer
impl Send for MockLambdaRuntimeApiServer
impl Sync for MockLambdaRuntimeApiServer
impl Unpin for MockLambdaRuntimeApiServer
impl UnwindSafe for MockLambdaRuntimeApiServer
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