pub struct Extension<'a, E, L, T> { /* private fields */ }
Expand description

An Extension that runs event, log and telemetry processors

Implementations§

source§

impl<'a> Extension<'a, Identity<LambdaEvent>, MakeIdentity<Vec<LambdaLog>>, MakeIdentity<Vec<LambdaTelemetry>>>

source

pub fn new() -> Self

Create a new base Extension with a no-op events processor

source§

impl<'a, E, L, T> Extension<'a, E, L, T>where E: Service<LambdaEvent>, E::Future: Future<Output = Result<(), E::Error>>, E::Error: Into<Box<dyn Error + Send + Sync>> + Display + Debug, L: MakeService<(), Vec<LambdaLog>, Response = ()> + Send + Sync + 'static, L::Service: Service<Vec<LambdaLog>, Response = ()> + Send + Sync, <L::Service as Service<Vec<LambdaLog>>>::Future: Send + 'a, L::Error: Into<Box<dyn Error + Send + Sync>> + Debug, L::MakeError: Into<Box<dyn Error + Send + Sync>> + Debug, L::Future: Send, T: MakeService<(), Vec<LambdaTelemetry>, Response = ()> + Send + Sync + 'static, T::Service: Service<Vec<LambdaTelemetry>, Response = ()> + Send + Sync, <T::Service as Service<Vec<LambdaTelemetry>>>::Future: Send + 'a, T::Error: Into<Box<dyn Error + Send + Sync>> + Debug, T::MakeError: Into<Box<dyn Error + Send + Sync>> + Debug, T::Future: Send,

source

pub fn with_extension_name(self, extension_name: &'a str) -> Self

Create a new Extension with a given extension name

source

pub fn with_events(self, events: &'a [&'a str]) -> Self

Create a new Extension with a list of given events. The only accepted events are INVOKE and SHUTDOWN.

source

pub fn with_events_processor<N>(self, ep: N) -> Extension<'a, N, L, T>where N: Service<LambdaEvent>, N::Future: Future<Output = Result<(), N::Error>>, N::Error: Into<Box<dyn Error + Send + Sync>> + Display,

Create a new Extension with a service that receives Lambda events.

source

pub fn with_logs_processor<N, NS>(self, lp: N) -> Extension<'a, E, N, T>where N: Service<()>, N::Future: Future<Output = Result<NS, N::Error>>, N::Error: Into<Box<dyn Error + Send + Sync>> + Display,

Create a new Extension with a service that receives Lambda logs.

source

pub fn with_log_types(self, log_types: &'a [&'a str]) -> Self

Create a new Extension with a list of logs types to subscribe. The only accepted log types are function, platform, and extension.

source

pub fn with_log_buffering(self, lb: LogBuffering) -> Self

Create a new Extension with specific configuration to buffer logs.

source

pub fn with_log_port_number(self, port_number: u16) -> Self

Create a new Extension with a different port number to listen to logs.

source

pub fn with_telemetry_processor<N, NS>(self, lp: N) -> Extension<'a, E, L, N>where N: Service<()>, N::Future: Future<Output = Result<NS, N::Error>>, N::Error: Into<Box<dyn Error + Send + Sync>> + Display,

Create a new Extension with a service that receives Lambda telemetry data.

source

pub fn with_telemetry_types(self, telemetry_types: &'a [&'a str]) -> Self

Create a new Extension with a list of telemetry types to subscribe. The only accepted telemetry types are function, platform, and extension.

source

pub fn with_telemetry_buffering(self, lb: LogBuffering) -> Self

Create a new Extension with specific configuration to buffer telemetry.

source

pub fn with_telemetry_port_number(self, port_number: u16) -> Self

Create a new Extension with a different port number to listen to telemetry.

source

pub async fn run(self) -> Result<(), Error>

Execute the given extension

Trait Implementations§

source§

impl<'a> Default for Extension<'a, Identity<LambdaEvent>, MakeIdentity<Vec<LambdaLog>>, MakeIdentity<Vec<LambdaTelemetry>>>

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a, E, L, T> RefUnwindSafe for Extension<'a, E, L, T>where E: RefUnwindSafe, L: RefUnwindSafe, T: RefUnwindSafe,

§

impl<'a, E, L, T> Send for Extension<'a, E, L, T>where E: Send, L: Send, T: Send,

§

impl<'a, E, L, T> Sync for Extension<'a, E, L, T>where E: Sync, L: Sync, T: Sync,

§

impl<'a, E, L, T> Unpin for Extension<'a, E, L, T>where E: Unpin, L: Unpin, T: Unpin,

§

impl<'a, E, L, T> UnwindSafe for Extension<'a, E, L, T>where E: UnwindSafe, L: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more