shuttle_runtime

Trait IntoResource

Source
pub trait IntoResource<R>: Serialize + DeserializeOwned {
    // Required method
    fn into_resource<'async_trait>(
        self,
    ) -> Pin<Box<dyn Future<Output = Result<R, Error>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

Implement this on an ResourceInputBuilder::Output type to turn the base resource into the end type exposed to the Shuttle main function.

Required Methods§

Source

fn into_resource<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<R, Error>> + Send + 'async_trait>>
where Self: 'async_trait,

Initialize any logic for creating the final resource of type R from the base resource.

Example: turn a connection string into a connection pool.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<R> IntoResource<R> for ShuttleResourceOutput<R>

Source§

fn into_resource<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<R, Error>> + Send + 'async_trait>>
where ShuttleResourceOutput<R>: 'async_trait,

Implementors§

Source§

impl<R> IntoResource<R> for R