Trait sentry_core::TransportFactory

source ·
pub trait TransportFactory: Send + Sync {
    // Required method
    fn create_transport(&self, options: &ClientOptions) -> Arc<dyn Transport>;
}
Expand description

A factory creating transport instances.

Because options are potentially reused between different clients the options do not actually contain a transport but a factory object that can create transports instead.

The factory has a single method that creates a new arced transport. Because transports can be wrapped in Arcs and those are clonable any Arc<Transport> is also a valid transport factory. This for instance lets you put a Arc<TestTransport> directly into the options.

This is automatically implemented for all closures optionally taking options and returning a boxed factory.

Required Methods§

source

fn create_transport(&self, options: &ClientOptions) -> Arc<dyn Transport>

Given some options creates a transport.

Implementations on Foreign Types§

source§

impl<T: Transport> TransportFactory for Arc<T>

Implementors§

source§

impl<F> TransportFactory for F
where F: Fn(&ClientOptions) -> Arc<dyn Transport> + Clone + Send + Sync + 'static,