pub trait Component: Send + Sync {
// Required methods
fn scheme(&self) -> &str;
fn create_endpoint(
&self,
uri: &str,
ctx: &dyn ComponentContext,
) -> Result<Box<dyn Endpoint>, CamelError>;
// Provided methods
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
A Component is a factory for Endpoints.
Each component handles a specific URI scheme (e.g. “timer”, “log”, “direct”).
Required Methods§
Sourcefn create_endpoint(
&self,
uri: &str,
ctx: &dyn ComponentContext,
) -> Result<Box<dyn Endpoint>, CamelError>
fn create_endpoint( &self, uri: &str, ctx: &dyn ComponentContext, ) -> Result<Box<dyn Endpoint>, CamelError>
Create an endpoint from a URI string.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".