Skip to main content

camel_api/
endpoint_pipeline.rs

1use std::sync::Arc;
2
3use crate::BoxProcessor;
4
5pub const CAMEL_SLIP_ENDPOINT: &str = "CamelSlipEndpoint";
6
7pub type EndpointResolver = Arc<dyn Fn(&str) -> Option<BoxProcessor> + Send + Sync>;
8
9#[derive(Clone)]
10pub struct EndpointPipelineConfig {
11    pub cache_size: usize,
12    pub ignore_invalid_endpoints: bool,
13}
14
15impl EndpointPipelineConfig {
16    pub fn from_signed(n: i32) -> usize {
17        if n <= 0 { 0 } else { n as usize }
18    }
19}
20
21impl Default for EndpointPipelineConfig {
22    fn default() -> Self {
23        Self {
24            cache_size: 1000,
25            ignore_invalid_endpoints: false,
26        }
27    }
28}