Struct MicrokernelServer

Source
pub struct MicrokernelServer<P: OAuthProviderTrait<S, DefaultClientManager<S>> + 'static, S: OAuthStorage + Clone + 'static, M: McpServerHandler = McpServer> { /* private fields */ }
Expand description

Microkernel server builder that composes independent handlers

This builder demonstrates the microkernel principle where services are composed from independent, single-responsibility components. Now supports any OAuth provider, storage backend, MCP server, and custom routers through trait abstraction.

Implementations§

Source§

impl<P: OAuthProviderTrait<S, DefaultClientManager<S>> + 'static, S: OAuthStorage + Clone + 'static, M: McpServerHandler> MicrokernelServer<P, S, M>

Source

pub fn new() -> Self

Create a new microkernel server builder

Examples found in repository?
examples/simple_custom_router_test.rs (line 53)
30async fn main() -> Result<(), Box<dyn std::error::Error>> {
31    println!("🧪 Testing custom router functionality...");
32
33    // Create OAuth provider
34    let github_config = GitHubOAuthConfig {
35        client_id: "test_client_id".to_string(),
36        client_secret: "test_client_secret".to_string(),
37        redirect_uri: "http://localhost:8080/oauth/callback".to_string(),
38        scope: "read:user".to_string(),
39        provider_name: "github".to_string(),
40    };
41
42    let github_oauth_provider = GitHubOAuthProvider::new_github(github_config);
43    let oauth_provider = OAuthProvider::new(github_oauth_provider);
44
45    // Create custom routers
46    let health_router = Router::new()
47        .route("/health", get(health_check));
48
49    let api_router = Router::new()
50        .route("/status", get(api_status));
51
52    // Build microkernel server with custom routers
53    let microkernel: GitHubMicrokernelServer = MicrokernelServer::new()
54        .with_oauth_provider(oauth_provider)
55        .with_custom_router(health_router)
56        .with_custom_router_config(
57            api_router,
58            CustomRouterConfig::with_prefix("/api"),
59        );
60
61    // Test that the router can be built
62    let router = microkernel.build_router()?;
63    println!("✅ Router built successfully!");
64
65    // Print available endpoints
66    println!("\n📋 Server would have these endpoints:");
67    println!("  OAuth:");
68    println!("    GET  /oauth/login");
69    println!("    GET  /oauth/callback");
70    println!("    POST /oauth/token");
71    println!("  Custom:");
72    println!("    GET  /health");
73    println!("    GET  /api/status");
74    
75    println!("\n🎉 Custom router functionality is working correctly!");
76    println!("   The server can be built and all routers are properly attached.");
77
78    Ok(())
79}
More examples
Hide additional examples
examples/custom_mcp_server_example.rs (line 478)
413async fn main() -> AppResult<()> {
414    // Load environment variables
415    dotenv::dotenv().ok();
416
417    // Load configuration
418    let config = Config::from_env()?;
419
420    // Initialize tracing
421    init_tracing(&config)?;
422
423    tracing::info!("Starting Custom MCP Server example with Cognito and DynamoDB storage...");
424
425    // Create Cognito OAuth configuration
426    let cognito_config = CognitoOAuthConfig {
427        client_id: config.cognito.client_id.clone(),
428        client_secret: config.cognito.client_secret.clone().unwrap_or_default(),
429        redirect_uri: format!(
430            "http://{}:{}/oauth/callback",
431            config.server.host, config.server.port
432        ),
433        scope: config.cognito.scope.clone(),
434        provider_name: "cognito".to_string(),
435    };
436
437    // Get DynamoDB configuration
438    let table_name =
439        env::var("DYNAMODB_TABLE_NAME").unwrap_or_else(|_| "oauth-storage".to_string());
440    let create_table = env::var("DYNAMODB_CREATE_TABLE")
441        .unwrap_or_else(|_| "true".to_string())
442        .parse::<bool>()
443        .unwrap_or(true);
444
445    // Log configuration
446    log_startup_info(&config, &table_name, create_table);
447
448    // Create DynamoDB storage
449    let (storage, client_manager) = create_dynamodb_storage(
450        table_name.clone(),
451        create_table,
452        Some("expires_at".to_string()),
453    )
454    .await
455    .map_err(|e| {
456        remote_mcp_kernel::error::AppError::Internal(format!(
457            "Failed to create DynamoDB storage: {}",
458            e
459        ))
460    })?;
461
462    // Create Cognito OAuth provider with DynamoDB storage
463    let oauth_handler = oauth_provider_rs::CognitoOAuthHandler::new_simple(
464        storage,
465        client_manager,
466        cognito_config,
467        config.cognito.cognito_domain.clone(),
468        config.cognito.region.clone(),
469        config.cognito.user_pool_id.clone(),
470    );
471
472    let oauth_provider = OAuthProvider::new(oauth_handler);
473
474    // Create custom MCP server
475    let custom_mcp_server = CustomMcpServer::new("Custom File & System MCP Server".to_string());
476
477    // Build microkernel with custom MCP server using convenience methods
478    let microkernel = MicrokernelServer::new()
479        .with_oauth_provider(oauth_provider)
480        .with_mcp_streamable_handler(custom_mcp_server.clone())
481        .with_mcp_sse_handler(custom_mcp_server, SseHandlerConfig::default());
482
483    // Start the microkernel server
484    let bind_address = config.bind_socket_addr()?;
485    tracing::info!("🚀 Starting microkernel server on {}", bind_address);
486    microkernel.serve(bind_address).await?;
487
488    Ok(())
489}
examples/custom_router_example.rs (line 168)
107async fn main() -> Result<(), Box<dyn std::error::Error>> {
108    // Initialize tracing for logging
109    tracing_subscriber::fmt::init();
110
111    // Create GitHub OAuth provider
112    let github_config = GitHubOAuthConfig {
113        client_id: std::env::var("GITHUB_CLIENT_ID").unwrap_or_else(|_| "demo_client_id".to_string()),
114        client_secret: std::env::var("GITHUB_CLIENT_SECRET").unwrap_or_else(|_| "demo_client_secret".to_string()),
115        redirect_uri: "http://localhost:8080/oauth/callback".to_string(),
116        scope: "read:user".to_string(),
117        provider_name: "github".to_string(),
118    };
119
120    let github_oauth_provider = GitHubOAuthProvider::new_github(github_config);
121    let oauth_provider = OAuthProvider::new(github_oauth_provider);
122
123    // Create custom routers
124    
125    // 1. Health and basic endpoints router
126    let health_router = Router::new()
127        .route("/health", get(health_check))
128        .route("/webhooks", post(webhook_handler));
129
130    // 2. Monitoring router with path prefix
131    let monitoring_router = Router::new()
132        .route("/metrics", get(metrics));
133
134    // 3. API router with versioned endpoints
135    let api_router = Router::new()
136        .route("/v1/status", get(api_status))
137        .route("/{version}/status", get(api_status));
138
139    // 4. Admin router with HTML interface
140    let admin_router = Router::new()
141        .route("/", get(admin_dashboard));
142
143    // Configure custom routers with different configurations
144    let custom_routers = vec![
145        // Health router without prefix (attached to root)
146        (health_router, CustomRouterConfig::default()),
147        
148        // Monitoring router with prefix and name
149        (
150            monitoring_router,
151            CustomRouterConfig::with_name_and_prefix("Monitoring", "/monitoring"),
152        ),
153        
154        // API router with prefix
155        (
156            api_router,
157            CustomRouterConfig::with_name_and_prefix("API", "/api"),
158        ),
159        
160        // Admin router with prefix
161        (
162            admin_router,
163            CustomRouterConfig::with_name_and_prefix("Admin Dashboard", "/admin"),
164        ),
165    ];
166
167    // Build the microkernel server with OAuth provider and custom routers
168    let microkernel: GitHubMicrokernelServer = MicrokernelServer::new()
169        .with_oauth_provider(oauth_provider)
170        .with_custom_routers(custom_routers);
171
172    // Define the bind address
173    let bind_address: SocketAddr = "127.0.0.1:8080".parse()?;
174
175    // Print available endpoints
176    println!("🚀 Starting microkernel server with custom routers...");
177    println!("📍 Server listening on: http://{}", bind_address);
178    println!("\n📋 Available endpoints:");
179    println!("  OAuth:");
180    println!("    GET  /oauth/login");
181    println!("    GET  /oauth/callback");
182    println!("    POST /oauth/token");
183    println!("  Custom Endpoints:");
184    println!("    GET  /health                  - Health check");
185    println!("    POST /webhooks                - Webhook handler");
186    println!("    GET  /monitoring/metrics      - System metrics");
187    println!("    GET  /api/v1/status           - API status");
188    println!("    GET  /api/{{version}}/status   - Versioned API status");
189    println!("    GET  /admin                   - Admin dashboard");
190    println!("\n🔧 Try these commands:");
191    println!("  curl http://localhost:8080/health");
192    println!("  curl http://localhost:8080/monitoring/metrics");
193    println!("  curl http://localhost:8080/api/v1/status");
194    println!("  open http://localhost:8080/admin");
195
196    // Start the server
197    microkernel.serve(bind_address).await?;
198
199    Ok(())
200}
Source

pub fn with_oauth_provider(self, oauth_provider: OAuthProvider<P, S>) -> Self

Add OAuth provider handler

Examples found in repository?
examples/simple_custom_router_test.rs (line 54)
30async fn main() -> Result<(), Box<dyn std::error::Error>> {
31    println!("🧪 Testing custom router functionality...");
32
33    // Create OAuth provider
34    let github_config = GitHubOAuthConfig {
35        client_id: "test_client_id".to_string(),
36        client_secret: "test_client_secret".to_string(),
37        redirect_uri: "http://localhost:8080/oauth/callback".to_string(),
38        scope: "read:user".to_string(),
39        provider_name: "github".to_string(),
40    };
41
42    let github_oauth_provider = GitHubOAuthProvider::new_github(github_config);
43    let oauth_provider = OAuthProvider::new(github_oauth_provider);
44
45    // Create custom routers
46    let health_router = Router::new()
47        .route("/health", get(health_check));
48
49    let api_router = Router::new()
50        .route("/status", get(api_status));
51
52    // Build microkernel server with custom routers
53    let microkernel: GitHubMicrokernelServer = MicrokernelServer::new()
54        .with_oauth_provider(oauth_provider)
55        .with_custom_router(health_router)
56        .with_custom_router_config(
57            api_router,
58            CustomRouterConfig::with_prefix("/api"),
59        );
60
61    // Test that the router can be built
62    let router = microkernel.build_router()?;
63    println!("✅ Router built successfully!");
64
65    // Print available endpoints
66    println!("\n📋 Server would have these endpoints:");
67    println!("  OAuth:");
68    println!("    GET  /oauth/login");
69    println!("    GET  /oauth/callback");
70    println!("    POST /oauth/token");
71    println!("  Custom:");
72    println!("    GET  /health");
73    println!("    GET  /api/status");
74    
75    println!("\n🎉 Custom router functionality is working correctly!");
76    println!("   The server can be built and all routers are properly attached.");
77
78    Ok(())
79}
More examples
Hide additional examples
examples/custom_mcp_server_example.rs (line 479)
413async fn main() -> AppResult<()> {
414    // Load environment variables
415    dotenv::dotenv().ok();
416
417    // Load configuration
418    let config = Config::from_env()?;
419
420    // Initialize tracing
421    init_tracing(&config)?;
422
423    tracing::info!("Starting Custom MCP Server example with Cognito and DynamoDB storage...");
424
425    // Create Cognito OAuth configuration
426    let cognito_config = CognitoOAuthConfig {
427        client_id: config.cognito.client_id.clone(),
428        client_secret: config.cognito.client_secret.clone().unwrap_or_default(),
429        redirect_uri: format!(
430            "http://{}:{}/oauth/callback",
431            config.server.host, config.server.port
432        ),
433        scope: config.cognito.scope.clone(),
434        provider_name: "cognito".to_string(),
435    };
436
437    // Get DynamoDB configuration
438    let table_name =
439        env::var("DYNAMODB_TABLE_NAME").unwrap_or_else(|_| "oauth-storage".to_string());
440    let create_table = env::var("DYNAMODB_CREATE_TABLE")
441        .unwrap_or_else(|_| "true".to_string())
442        .parse::<bool>()
443        .unwrap_or(true);
444
445    // Log configuration
446    log_startup_info(&config, &table_name, create_table);
447
448    // Create DynamoDB storage
449    let (storage, client_manager) = create_dynamodb_storage(
450        table_name.clone(),
451        create_table,
452        Some("expires_at".to_string()),
453    )
454    .await
455    .map_err(|e| {
456        remote_mcp_kernel::error::AppError::Internal(format!(
457            "Failed to create DynamoDB storage: {}",
458            e
459        ))
460    })?;
461
462    // Create Cognito OAuth provider with DynamoDB storage
463    let oauth_handler = oauth_provider_rs::CognitoOAuthHandler::new_simple(
464        storage,
465        client_manager,
466        cognito_config,
467        config.cognito.cognito_domain.clone(),
468        config.cognito.region.clone(),
469        config.cognito.user_pool_id.clone(),
470    );
471
472    let oauth_provider = OAuthProvider::new(oauth_handler);
473
474    // Create custom MCP server
475    let custom_mcp_server = CustomMcpServer::new("Custom File & System MCP Server".to_string());
476
477    // Build microkernel with custom MCP server using convenience methods
478    let microkernel = MicrokernelServer::new()
479        .with_oauth_provider(oauth_provider)
480        .with_mcp_streamable_handler(custom_mcp_server.clone())
481        .with_mcp_sse_handler(custom_mcp_server, SseHandlerConfig::default());
482
483    // Start the microkernel server
484    let bind_address = config.bind_socket_addr()?;
485    tracing::info!("🚀 Starting microkernel server on {}", bind_address);
486    microkernel.serve(bind_address).await?;
487
488    Ok(())
489}
examples/custom_router_example.rs (line 169)
107async fn main() -> Result<(), Box<dyn std::error::Error>> {
108    // Initialize tracing for logging
109    tracing_subscriber::fmt::init();
110
111    // Create GitHub OAuth provider
112    let github_config = GitHubOAuthConfig {
113        client_id: std::env::var("GITHUB_CLIENT_ID").unwrap_or_else(|_| "demo_client_id".to_string()),
114        client_secret: std::env::var("GITHUB_CLIENT_SECRET").unwrap_or_else(|_| "demo_client_secret".to_string()),
115        redirect_uri: "http://localhost:8080/oauth/callback".to_string(),
116        scope: "read:user".to_string(),
117        provider_name: "github".to_string(),
118    };
119
120    let github_oauth_provider = GitHubOAuthProvider::new_github(github_config);
121    let oauth_provider = OAuthProvider::new(github_oauth_provider);
122
123    // Create custom routers
124    
125    // 1. Health and basic endpoints router
126    let health_router = Router::new()
127        .route("/health", get(health_check))
128        .route("/webhooks", post(webhook_handler));
129
130    // 2. Monitoring router with path prefix
131    let monitoring_router = Router::new()
132        .route("/metrics", get(metrics));
133
134    // 3. API router with versioned endpoints
135    let api_router = Router::new()
136        .route("/v1/status", get(api_status))
137        .route("/{version}/status", get(api_status));
138
139    // 4. Admin router with HTML interface
140    let admin_router = Router::new()
141        .route("/", get(admin_dashboard));
142
143    // Configure custom routers with different configurations
144    let custom_routers = vec![
145        // Health router without prefix (attached to root)
146        (health_router, CustomRouterConfig::default()),
147        
148        // Monitoring router with prefix and name
149        (
150            monitoring_router,
151            CustomRouterConfig::with_name_and_prefix("Monitoring", "/monitoring"),
152        ),
153        
154        // API router with prefix
155        (
156            api_router,
157            CustomRouterConfig::with_name_and_prefix("API", "/api"),
158        ),
159        
160        // Admin router with prefix
161        (
162            admin_router,
163            CustomRouterConfig::with_name_and_prefix("Admin Dashboard", "/admin"),
164        ),
165    ];
166
167    // Build the microkernel server with OAuth provider and custom routers
168    let microkernel: GitHubMicrokernelServer = MicrokernelServer::new()
169        .with_oauth_provider(oauth_provider)
170        .with_custom_routers(custom_routers);
171
172    // Define the bind address
173    let bind_address: SocketAddr = "127.0.0.1:8080".parse()?;
174
175    // Print available endpoints
176    println!("🚀 Starting microkernel server with custom routers...");
177    println!("📍 Server listening on: http://{}", bind_address);
178    println!("\n📋 Available endpoints:");
179    println!("  OAuth:");
180    println!("    GET  /oauth/login");
181    println!("    GET  /oauth/callback");
182    println!("    POST /oauth/token");
183    println!("  Custom Endpoints:");
184    println!("    GET  /health                  - Health check");
185    println!("    POST /webhooks                - Webhook handler");
186    println!("    GET  /monitoring/metrics      - System metrics");
187    println!("    GET  /api/v1/status           - API status");
188    println!("    GET  /api/{{version}}/status   - Versioned API status");
189    println!("    GET  /admin                   - Admin dashboard");
190    println!("\n🔧 Try these commands:");
191    println!("  curl http://localhost:8080/health");
192    println!("  curl http://localhost:8080/monitoring/metrics");
193    println!("  curl http://localhost:8080/api/v1/status");
194    println!("  open http://localhost:8080/admin");
195
196    // Start the server
197    microkernel.serve(bind_address).await?;
198
199    Ok(())
200}
Source

pub fn with_streamable_handler( self, streamable_handler: StreamableHttpHandler<M>, ) -> Self

Add streamable HTTP handler

Source

pub fn with_sse_handler( self, sse_handler: SseHandler<M>, config: SseHandlerConfig, ) -> Self

Add SSE handler with configuration

Source

pub fn with_mcp_sse_handler( self, mcp_server: M, config: SseHandlerConfig, ) -> Self

Create SSE handler with MCP server and configuration

Examples found in repository?
examples/custom_mcp_server_example.rs (line 481)
413async fn main() -> AppResult<()> {
414    // Load environment variables
415    dotenv::dotenv().ok();
416
417    // Load configuration
418    let config = Config::from_env()?;
419
420    // Initialize tracing
421    init_tracing(&config)?;
422
423    tracing::info!("Starting Custom MCP Server example with Cognito and DynamoDB storage...");
424
425    // Create Cognito OAuth configuration
426    let cognito_config = CognitoOAuthConfig {
427        client_id: config.cognito.client_id.clone(),
428        client_secret: config.cognito.client_secret.clone().unwrap_or_default(),
429        redirect_uri: format!(
430            "http://{}:{}/oauth/callback",
431            config.server.host, config.server.port
432        ),
433        scope: config.cognito.scope.clone(),
434        provider_name: "cognito".to_string(),
435    };
436
437    // Get DynamoDB configuration
438    let table_name =
439        env::var("DYNAMODB_TABLE_NAME").unwrap_or_else(|_| "oauth-storage".to_string());
440    let create_table = env::var("DYNAMODB_CREATE_TABLE")
441        .unwrap_or_else(|_| "true".to_string())
442        .parse::<bool>()
443        .unwrap_or(true);
444
445    // Log configuration
446    log_startup_info(&config, &table_name, create_table);
447
448    // Create DynamoDB storage
449    let (storage, client_manager) = create_dynamodb_storage(
450        table_name.clone(),
451        create_table,
452        Some("expires_at".to_string()),
453    )
454    .await
455    .map_err(|e| {
456        remote_mcp_kernel::error::AppError::Internal(format!(
457            "Failed to create DynamoDB storage: {}",
458            e
459        ))
460    })?;
461
462    // Create Cognito OAuth provider with DynamoDB storage
463    let oauth_handler = oauth_provider_rs::CognitoOAuthHandler::new_simple(
464        storage,
465        client_manager,
466        cognito_config,
467        config.cognito.cognito_domain.clone(),
468        config.cognito.region.clone(),
469        config.cognito.user_pool_id.clone(),
470    );
471
472    let oauth_provider = OAuthProvider::new(oauth_handler);
473
474    // Create custom MCP server
475    let custom_mcp_server = CustomMcpServer::new("Custom File & System MCP Server".to_string());
476
477    // Build microkernel with custom MCP server using convenience methods
478    let microkernel = MicrokernelServer::new()
479        .with_oauth_provider(oauth_provider)
480        .with_mcp_streamable_handler(custom_mcp_server.clone())
481        .with_mcp_sse_handler(custom_mcp_server, SseHandlerConfig::default());
482
483    // Start the microkernel server
484    let bind_address = config.bind_socket_addr()?;
485    tracing::info!("🚀 Starting microkernel server on {}", bind_address);
486    microkernel.serve(bind_address).await?;
487
488    Ok(())
489}
Source

pub fn with_mcp_streamable_handler(self, mcp_server: M) -> Self

Create streamable HTTP handler with MCP server

Examples found in repository?
examples/custom_mcp_server_example.rs (line 480)
413async fn main() -> AppResult<()> {
414    // Load environment variables
415    dotenv::dotenv().ok();
416
417    // Load configuration
418    let config = Config::from_env()?;
419
420    // Initialize tracing
421    init_tracing(&config)?;
422
423    tracing::info!("Starting Custom MCP Server example with Cognito and DynamoDB storage...");
424
425    // Create Cognito OAuth configuration
426    let cognito_config = CognitoOAuthConfig {
427        client_id: config.cognito.client_id.clone(),
428        client_secret: config.cognito.client_secret.clone().unwrap_or_default(),
429        redirect_uri: format!(
430            "http://{}:{}/oauth/callback",
431            config.server.host, config.server.port
432        ),
433        scope: config.cognito.scope.clone(),
434        provider_name: "cognito".to_string(),
435    };
436
437    // Get DynamoDB configuration
438    let table_name =
439        env::var("DYNAMODB_TABLE_NAME").unwrap_or_else(|_| "oauth-storage".to_string());
440    let create_table = env::var("DYNAMODB_CREATE_TABLE")
441        .unwrap_or_else(|_| "true".to_string())
442        .parse::<bool>()
443        .unwrap_or(true);
444
445    // Log configuration
446    log_startup_info(&config, &table_name, create_table);
447
448    // Create DynamoDB storage
449    let (storage, client_manager) = create_dynamodb_storage(
450        table_name.clone(),
451        create_table,
452        Some("expires_at".to_string()),
453    )
454    .await
455    .map_err(|e| {
456        remote_mcp_kernel::error::AppError::Internal(format!(
457            "Failed to create DynamoDB storage: {}",
458            e
459        ))
460    })?;
461
462    // Create Cognito OAuth provider with DynamoDB storage
463    let oauth_handler = oauth_provider_rs::CognitoOAuthHandler::new_simple(
464        storage,
465        client_manager,
466        cognito_config,
467        config.cognito.cognito_domain.clone(),
468        config.cognito.region.clone(),
469        config.cognito.user_pool_id.clone(),
470    );
471
472    let oauth_provider = OAuthProvider::new(oauth_handler);
473
474    // Create custom MCP server
475    let custom_mcp_server = CustomMcpServer::new("Custom File & System MCP Server".to_string());
476
477    // Build microkernel with custom MCP server using convenience methods
478    let microkernel = MicrokernelServer::new()
479        .with_oauth_provider(oauth_provider)
480        .with_mcp_streamable_handler(custom_mcp_server.clone())
481        .with_mcp_sse_handler(custom_mcp_server, SseHandlerConfig::default());
482
483    // Start the microkernel server
484    let bind_address = config.bind_socket_addr()?;
485    tracing::info!("🚀 Starting microkernel server on {}", bind_address);
486    microkernel.serve(bind_address).await?;
487
488    Ok(())
489}
Source

pub fn with_custom_router(self, router: Router) -> Self

Attach a custom router to the microkernel server

This method allows attaching arbitrary axum Routers to the microkernel server, enabling extension of the server with custom endpoints while maintaining microkernel architecture principles.

§Arguments
  • router - The axum Router to attach
§Examples
use axum::{Router, routing::get, response::Html};
use remote_mcp_kernel::microkernel::GitHubMicrokernelServer;
 
async fn hello() -> Html<&'static str> {
    Html("<h1>Hello, World!</h1>")
}
 
let custom_router = Router::new()
    .route("/hello", get(hello));
 
let server: GitHubMicrokernelServer = GitHubMicrokernelServer::new()
    .with_custom_router(custom_router);
Examples found in repository?
examples/simple_custom_router_test.rs (line 55)
30async fn main() -> Result<(), Box<dyn std::error::Error>> {
31    println!("🧪 Testing custom router functionality...");
32
33    // Create OAuth provider
34    let github_config = GitHubOAuthConfig {
35        client_id: "test_client_id".to_string(),
36        client_secret: "test_client_secret".to_string(),
37        redirect_uri: "http://localhost:8080/oauth/callback".to_string(),
38        scope: "read:user".to_string(),
39        provider_name: "github".to_string(),
40    };
41
42    let github_oauth_provider = GitHubOAuthProvider::new_github(github_config);
43    let oauth_provider = OAuthProvider::new(github_oauth_provider);
44
45    // Create custom routers
46    let health_router = Router::new()
47        .route("/health", get(health_check));
48
49    let api_router = Router::new()
50        .route("/status", get(api_status));
51
52    // Build microkernel server with custom routers
53    let microkernel: GitHubMicrokernelServer = MicrokernelServer::new()
54        .with_oauth_provider(oauth_provider)
55        .with_custom_router(health_router)
56        .with_custom_router_config(
57            api_router,
58            CustomRouterConfig::with_prefix("/api"),
59        );
60
61    // Test that the router can be built
62    let router = microkernel.build_router()?;
63    println!("✅ Router built successfully!");
64
65    // Print available endpoints
66    println!("\n📋 Server would have these endpoints:");
67    println!("  OAuth:");
68    println!("    GET  /oauth/login");
69    println!("    GET  /oauth/callback");
70    println!("    POST /oauth/token");
71    println!("  Custom:");
72    println!("    GET  /health");
73    println!("    GET  /api/status");
74    
75    println!("\n🎉 Custom router functionality is working correctly!");
76    println!("   The server can be built and all routers are properly attached.");
77
78    Ok(())
79}
Source

pub fn with_custom_router_config( self, router: Router, config: CustomRouterConfig, ) -> Self

Attach a custom router with configuration to the microkernel server

This method provides more control over how the custom router is attached, allowing for custom configuration such as path prefixes and names.

§Arguments
  • router - The axum Router to attach
  • config - Configuration for the custom router
§Examples
use axum::{Router, routing::get, response::Html};
use remote_mcp_kernel::microkernel::{GitHubMicrokernelServer, CustomRouterConfig};
 
async fn api_status() -> Html<&'static str> {
    Html("<h1>API Status: OK</h1>")
}
 
let custom_router = Router::new()
    .route("/status", get(api_status));
 
let config = CustomRouterConfig {
    name: Some("API Router".to_string()),
    path_prefix: Some("/api".to_string()),
};
 
let server: GitHubMicrokernelServer = GitHubMicrokernelServer::new()
    .with_custom_router_config(custom_router, config);
Examples found in repository?
examples/simple_custom_router_test.rs (lines 56-59)
30async fn main() -> Result<(), Box<dyn std::error::Error>> {
31    println!("🧪 Testing custom router functionality...");
32
33    // Create OAuth provider
34    let github_config = GitHubOAuthConfig {
35        client_id: "test_client_id".to_string(),
36        client_secret: "test_client_secret".to_string(),
37        redirect_uri: "http://localhost:8080/oauth/callback".to_string(),
38        scope: "read:user".to_string(),
39        provider_name: "github".to_string(),
40    };
41
42    let github_oauth_provider = GitHubOAuthProvider::new_github(github_config);
43    let oauth_provider = OAuthProvider::new(github_oauth_provider);
44
45    // Create custom routers
46    let health_router = Router::new()
47        .route("/health", get(health_check));
48
49    let api_router = Router::new()
50        .route("/status", get(api_status));
51
52    // Build microkernel server with custom routers
53    let microkernel: GitHubMicrokernelServer = MicrokernelServer::new()
54        .with_oauth_provider(oauth_provider)
55        .with_custom_router(health_router)
56        .with_custom_router_config(
57            api_router,
58            CustomRouterConfig::with_prefix("/api"),
59        );
60
61    // Test that the router can be built
62    let router = microkernel.build_router()?;
63    println!("✅ Router built successfully!");
64
65    // Print available endpoints
66    println!("\n📋 Server would have these endpoints:");
67    println!("  OAuth:");
68    println!("    GET  /oauth/login");
69    println!("    GET  /oauth/callback");
70    println!("    POST /oauth/token");
71    println!("  Custom:");
72    println!("    GET  /health");
73    println!("    GET  /api/status");
74    
75    println!("\n🎉 Custom router functionality is working correctly!");
76    println!("   The server can be built and all routers are properly attached.");
77
78    Ok(())
79}
Source

pub fn with_custom_routers( self, routers: Vec<(Router, CustomRouterConfig)>, ) -> Self

Attach multiple custom routers at once

This method allows attaching multiple custom routers efficiently.

§Arguments
  • routers - A vector of tuples containing (Router, CustomRouterConfig)
§Examples
use axum::{Router, routing::get, response::Html};
use remote_mcp_kernel::microkernel::{GitHubMicrokernelServer, CustomRouterConfig};
 
async fn health() -> Html<&'static str> {
    Html("<h1>Health: OK</h1>")
}
 
async fn metrics() -> Html<&'static str> {
    Html("<h1>Metrics: OK</h1>")
}
 
let health_router = Router::new().route("/health", get(health));
let metrics_router = Router::new().route("/metrics", get(metrics));
 
let routers = vec![
    (health_router, CustomRouterConfig::default()),
    (metrics_router, CustomRouterConfig {
        name: Some("Metrics".to_string()),
        path_prefix: Some("/monitoring".to_string()),
    }),
];
 
let server: GitHubMicrokernelServer = GitHubMicrokernelServer::new()
    .with_custom_routers(routers);
Examples found in repository?
examples/custom_router_example.rs (line 170)
107async fn main() -> Result<(), Box<dyn std::error::Error>> {
108    // Initialize tracing for logging
109    tracing_subscriber::fmt::init();
110
111    // Create GitHub OAuth provider
112    let github_config = GitHubOAuthConfig {
113        client_id: std::env::var("GITHUB_CLIENT_ID").unwrap_or_else(|_| "demo_client_id".to_string()),
114        client_secret: std::env::var("GITHUB_CLIENT_SECRET").unwrap_or_else(|_| "demo_client_secret".to_string()),
115        redirect_uri: "http://localhost:8080/oauth/callback".to_string(),
116        scope: "read:user".to_string(),
117        provider_name: "github".to_string(),
118    };
119
120    let github_oauth_provider = GitHubOAuthProvider::new_github(github_config);
121    let oauth_provider = OAuthProvider::new(github_oauth_provider);
122
123    // Create custom routers
124    
125    // 1. Health and basic endpoints router
126    let health_router = Router::new()
127        .route("/health", get(health_check))
128        .route("/webhooks", post(webhook_handler));
129
130    // 2. Monitoring router with path prefix
131    let monitoring_router = Router::new()
132        .route("/metrics", get(metrics));
133
134    // 3. API router with versioned endpoints
135    let api_router = Router::new()
136        .route("/v1/status", get(api_status))
137        .route("/{version}/status", get(api_status));
138
139    // 4. Admin router with HTML interface
140    let admin_router = Router::new()
141        .route("/", get(admin_dashboard));
142
143    // Configure custom routers with different configurations
144    let custom_routers = vec![
145        // Health router without prefix (attached to root)
146        (health_router, CustomRouterConfig::default()),
147        
148        // Monitoring router with prefix and name
149        (
150            monitoring_router,
151            CustomRouterConfig::with_name_and_prefix("Monitoring", "/monitoring"),
152        ),
153        
154        // API router with prefix
155        (
156            api_router,
157            CustomRouterConfig::with_name_and_prefix("API", "/api"),
158        ),
159        
160        // Admin router with prefix
161        (
162            admin_router,
163            CustomRouterConfig::with_name_and_prefix("Admin Dashboard", "/admin"),
164        ),
165    ];
166
167    // Build the microkernel server with OAuth provider and custom routers
168    let microkernel: GitHubMicrokernelServer = MicrokernelServer::new()
169        .with_oauth_provider(oauth_provider)
170        .with_custom_routers(custom_routers);
171
172    // Define the bind address
173    let bind_address: SocketAddr = "127.0.0.1:8080".parse()?;
174
175    // Print available endpoints
176    println!("🚀 Starting microkernel server with custom routers...");
177    println!("📍 Server listening on: http://{}", bind_address);
178    println!("\n📋 Available endpoints:");
179    println!("  OAuth:");
180    println!("    GET  /oauth/login");
181    println!("    GET  /oauth/callback");
182    println!("    POST /oauth/token");
183    println!("  Custom Endpoints:");
184    println!("    GET  /health                  - Health check");
185    println!("    POST /webhooks                - Webhook handler");
186    println!("    GET  /monitoring/metrics      - System metrics");
187    println!("    GET  /api/v1/status           - API status");
188    println!("    GET  /api/{{version}}/status   - Versioned API status");
189    println!("    GET  /admin                   - Admin dashboard");
190    println!("\n🔧 Try these commands:");
191    println!("  curl http://localhost:8080/health");
192    println!("  curl http://localhost:8080/monitoring/metrics");
193    println!("  curl http://localhost:8080/api/v1/status");
194    println!("  open http://localhost:8080/admin");
195
196    // Start the server
197    microkernel.serve(bind_address).await?;
198
199    Ok(())
200}
Source

pub fn build_router(self) -> AppResult<Router>

Build the composed router from all registered handlers

This method demonstrates the microkernel composition principle where independent components are combined into a unified service. Now includes support for custom routers with path prefixes and configuration.

Examples found in repository?
examples/simple_custom_router_test.rs (line 62)
30async fn main() -> Result<(), Box<dyn std::error::Error>> {
31    println!("🧪 Testing custom router functionality...");
32
33    // Create OAuth provider
34    let github_config = GitHubOAuthConfig {
35        client_id: "test_client_id".to_string(),
36        client_secret: "test_client_secret".to_string(),
37        redirect_uri: "http://localhost:8080/oauth/callback".to_string(),
38        scope: "read:user".to_string(),
39        provider_name: "github".to_string(),
40    };
41
42    let github_oauth_provider = GitHubOAuthProvider::new_github(github_config);
43    let oauth_provider = OAuthProvider::new(github_oauth_provider);
44
45    // Create custom routers
46    let health_router = Router::new()
47        .route("/health", get(health_check));
48
49    let api_router = Router::new()
50        .route("/status", get(api_status));
51
52    // Build microkernel server with custom routers
53    let microkernel: GitHubMicrokernelServer = MicrokernelServer::new()
54        .with_oauth_provider(oauth_provider)
55        .with_custom_router(health_router)
56        .with_custom_router_config(
57            api_router,
58            CustomRouterConfig::with_prefix("/api"),
59        );
60
61    // Test that the router can be built
62    let router = microkernel.build_router()?;
63    println!("✅ Router built successfully!");
64
65    // Print available endpoints
66    println!("\n📋 Server would have these endpoints:");
67    println!("  OAuth:");
68    println!("    GET  /oauth/login");
69    println!("    GET  /oauth/callback");
70    println!("    POST /oauth/token");
71    println!("  Custom:");
72    println!("    GET  /health");
73    println!("    GET  /api/status");
74    
75    println!("\n🎉 Custom router functionality is working correctly!");
76    println!("   The server can be built and all routers are properly attached.");
77
78    Ok(())
79}
Source

pub async fn serve(self, bind_address: SocketAddr) -> AppResult<()>

Start the microkernel server

Examples found in repository?
examples/oauth_standard_mcp_server.rs (line 38)
8async fn main() -> AppResult<()> {
9    // Load environment variables
10    dotenv::dotenv().ok();
11
12    // Load configuration
13    let config = Config::from_env()?;
14
15    // Initialize tracing
16    init_tracing(&config)?;
17
18    tracing::info!("Starting MCP OAuth server with microkernel architecture...");
19
20    // Create OAuth provider
21    let github_config = GitHubOAuthConfig {
22        client_id: config.github.client_id.clone(),
23        client_secret: config.github.client_secret.clone(),
24        redirect_uri: config.github.redirect_uri.clone(),
25        scope: config.github.scope.clone(),
26        provider_name: "github".to_string(),
27    };
28    let oauth_provider = GitHubOAuthProvider::new_github(github_config);
29
30    // Log configuration
31    log_startup_info(&config);
32
33    // Create microkernel server with all handlers composed
34    let microkernel = create_full_github_microkernel(oauth_provider);
35
36    // Start the microkernel server
37    let bind_address = config.bind_socket_addr()?;
38    microkernel.serve(bind_address).await?;
39
40    Ok(())
41}
More examples
Hide additional examples
examples/oauth_cognito_mcp_server.rs (line 43)
8async fn main() -> AppResult<()> {
9    // Load environment variables
10    dotenv::dotenv().ok();
11
12    // Load configuration
13    let config = Config::from_env()?;
14
15    // Initialize tracing
16    init_tracing(&config)?;
17
18    tracing::info!("Starting MCP OAuth server with Cognito and microkernel architecture...");
19
20    // Create Cognito OAuth provider
21    let cognito_config = CognitoOAuthConfig {
22        client_id: config.cognito.client_id.clone(),
23        client_secret: config.cognito.client_secret.clone().unwrap_or_default(),
24        redirect_uri: config.cognito.redirect_uri.clone(),
25        scope: config.cognito.scope.clone(),
26        provider_name: "cognito".to_string(),
27    };
28    let oauth_provider = CognitoOAuthProvider::new_cognito(
29        cognito_config,
30        config.cognito.cognito_domain.clone(),
31        config.cognito.region.clone(),
32        config.cognito.user_pool_id.clone(),
33    );
34
35    // Log configuration
36    log_startup_info(&config);
37
38    // Create microkernel server with all handlers composed
39    let microkernel = create_full_cognito_microkernel(oauth_provider);
40
41    // Start the microkernel server
42    let bind_address = config.bind_socket_addr()?;
43    microkernel.serve(bind_address).await?;
44
45    Ok(())
46}
examples/oauth_cognito_dynamodb_mcp_server.rs (line 110)
59async fn main() -> AppResult<()> {
60    // Load environment variables
61    dotenv::dotenv().ok();
62
63    // Load configuration
64    let config = Config::from_env()?;
65
66    // Initialize tracing
67    init_tracing(&config)?;
68
69    tracing::info!("Starting MCP OAuth server with Cognito and DynamoDB storage...");
70
71    // Create Cognito OAuth configuration
72    let cognito_config = CognitoOAuthConfig {
73        client_id: config.cognito.client_id.clone(),
74        client_secret: config.cognito.client_secret.clone().unwrap_or_default(),
75        redirect_uri: format!(
76            "http://{}:{}/oauth/callback",
77            config.server.host, config.server.port
78        ),
79        scope: config.cognito.scope.clone(),
80        provider_name: "cognito".to_string(),
81    };
82
83    // Get DynamoDB configuration
84    let table_name =
85        env::var("DYNAMODB_TABLE_NAME").unwrap_or_else(|_| "oauth-storage".to_string());
86    let create_table = env::var("DYNAMODB_CREATE_TABLE")
87        .unwrap_or_else(|_| "true".to_string())
88        .parse::<bool>()
89        .unwrap_or(true);
90
91    // Log configuration
92    log_startup_info(&config, &table_name, create_table);
93
94    // Create microkernel server with Cognito OAuth and DynamoDB storage
95    let microkernel = create_full_cognito_microkernel_dynamodb(
96        cognito_config,
97        config.cognito.cognito_domain.clone(),
98        config.cognito.region.clone(),
99        config.cognito.user_pool_id.clone(),
100        table_name,
101        create_table,
102    )
103    .await
104    .map_err(|e| {
105        remote_mcp_kernel::error::AppError::Internal(format!("Failed to create microkernel: {}", e))
106    })?;
107
108    // Start the microkernel server
109    let bind_address = config.bind_socket_addr()?;
110    microkernel.serve(bind_address).await?;
111
112    Ok(())
113}
examples/custom_mcp_server_example.rs (line 486)
413async fn main() -> AppResult<()> {
414    // Load environment variables
415    dotenv::dotenv().ok();
416
417    // Load configuration
418    let config = Config::from_env()?;
419
420    // Initialize tracing
421    init_tracing(&config)?;
422
423    tracing::info!("Starting Custom MCP Server example with Cognito and DynamoDB storage...");
424
425    // Create Cognito OAuth configuration
426    let cognito_config = CognitoOAuthConfig {
427        client_id: config.cognito.client_id.clone(),
428        client_secret: config.cognito.client_secret.clone().unwrap_or_default(),
429        redirect_uri: format!(
430            "http://{}:{}/oauth/callback",
431            config.server.host, config.server.port
432        ),
433        scope: config.cognito.scope.clone(),
434        provider_name: "cognito".to_string(),
435    };
436
437    // Get DynamoDB configuration
438    let table_name =
439        env::var("DYNAMODB_TABLE_NAME").unwrap_or_else(|_| "oauth-storage".to_string());
440    let create_table = env::var("DYNAMODB_CREATE_TABLE")
441        .unwrap_or_else(|_| "true".to_string())
442        .parse::<bool>()
443        .unwrap_or(true);
444
445    // Log configuration
446    log_startup_info(&config, &table_name, create_table);
447
448    // Create DynamoDB storage
449    let (storage, client_manager) = create_dynamodb_storage(
450        table_name.clone(),
451        create_table,
452        Some("expires_at".to_string()),
453    )
454    .await
455    .map_err(|e| {
456        remote_mcp_kernel::error::AppError::Internal(format!(
457            "Failed to create DynamoDB storage: {}",
458            e
459        ))
460    })?;
461
462    // Create Cognito OAuth provider with DynamoDB storage
463    let oauth_handler = oauth_provider_rs::CognitoOAuthHandler::new_simple(
464        storage,
465        client_manager,
466        cognito_config,
467        config.cognito.cognito_domain.clone(),
468        config.cognito.region.clone(),
469        config.cognito.user_pool_id.clone(),
470    );
471
472    let oauth_provider = OAuthProvider::new(oauth_handler);
473
474    // Create custom MCP server
475    let custom_mcp_server = CustomMcpServer::new("Custom File & System MCP Server".to_string());
476
477    // Build microkernel with custom MCP server using convenience methods
478    let microkernel = MicrokernelServer::new()
479        .with_oauth_provider(oauth_provider)
480        .with_mcp_streamable_handler(custom_mcp_server.clone())
481        .with_mcp_sse_handler(custom_mcp_server, SseHandlerConfig::default());
482
483    // Start the microkernel server
484    let bind_address = config.bind_socket_addr()?;
485    tracing::info!("🚀 Starting microkernel server on {}", bind_address);
486    microkernel.serve(bind_address).await?;
487
488    Ok(())
489}
examples/custom_router_example.rs (line 197)
107async fn main() -> Result<(), Box<dyn std::error::Error>> {
108    // Initialize tracing for logging
109    tracing_subscriber::fmt::init();
110
111    // Create GitHub OAuth provider
112    let github_config = GitHubOAuthConfig {
113        client_id: std::env::var("GITHUB_CLIENT_ID").unwrap_or_else(|_| "demo_client_id".to_string()),
114        client_secret: std::env::var("GITHUB_CLIENT_SECRET").unwrap_or_else(|_| "demo_client_secret".to_string()),
115        redirect_uri: "http://localhost:8080/oauth/callback".to_string(),
116        scope: "read:user".to_string(),
117        provider_name: "github".to_string(),
118    };
119
120    let github_oauth_provider = GitHubOAuthProvider::new_github(github_config);
121    let oauth_provider = OAuthProvider::new(github_oauth_provider);
122
123    // Create custom routers
124    
125    // 1. Health and basic endpoints router
126    let health_router = Router::new()
127        .route("/health", get(health_check))
128        .route("/webhooks", post(webhook_handler));
129
130    // 2. Monitoring router with path prefix
131    let monitoring_router = Router::new()
132        .route("/metrics", get(metrics));
133
134    // 3. API router with versioned endpoints
135    let api_router = Router::new()
136        .route("/v1/status", get(api_status))
137        .route("/{version}/status", get(api_status));
138
139    // 4. Admin router with HTML interface
140    let admin_router = Router::new()
141        .route("/", get(admin_dashboard));
142
143    // Configure custom routers with different configurations
144    let custom_routers = vec![
145        // Health router without prefix (attached to root)
146        (health_router, CustomRouterConfig::default()),
147        
148        // Monitoring router with prefix and name
149        (
150            monitoring_router,
151            CustomRouterConfig::with_name_and_prefix("Monitoring", "/monitoring"),
152        ),
153        
154        // API router with prefix
155        (
156            api_router,
157            CustomRouterConfig::with_name_and_prefix("API", "/api"),
158        ),
159        
160        // Admin router with prefix
161        (
162            admin_router,
163            CustomRouterConfig::with_name_and_prefix("Admin Dashboard", "/admin"),
164        ),
165    ];
166
167    // Build the microkernel server with OAuth provider and custom routers
168    let microkernel: GitHubMicrokernelServer = MicrokernelServer::new()
169        .with_oauth_provider(oauth_provider)
170        .with_custom_routers(custom_routers);
171
172    // Define the bind address
173    let bind_address: SocketAddr = "127.0.0.1:8080".parse()?;
174
175    // Print available endpoints
176    println!("🚀 Starting microkernel server with custom routers...");
177    println!("📍 Server listening on: http://{}", bind_address);
178    println!("\n📋 Available endpoints:");
179    println!("  OAuth:");
180    println!("    GET  /oauth/login");
181    println!("    GET  /oauth/callback");
182    println!("    POST /oauth/token");
183    println!("  Custom Endpoints:");
184    println!("    GET  /health                  - Health check");
185    println!("    POST /webhooks                - Webhook handler");
186    println!("    GET  /monitoring/metrics      - System metrics");
187    println!("    GET  /api/v1/status           - API status");
188    println!("    GET  /api/{{version}}/status   - Versioned API status");
189    println!("    GET  /admin                   - Admin dashboard");
190    println!("\n🔧 Try these commands:");
191    println!("  curl http://localhost:8080/health");
192    println!("  curl http://localhost:8080/monitoring/metrics");
193    println!("  curl http://localhost:8080/api/v1/status");
194    println!("  open http://localhost:8080/admin");
195
196    // Start the server
197    microkernel.serve(bind_address).await?;
198
199    Ok(())
200}

Trait Implementations§

Source§

impl<P: OAuthProviderTrait<S, DefaultClientManager<S>>, S: OAuthStorage + Clone + 'static, M: McpServerHandler> Default for MicrokernelServer<P, S, M>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<P, S, M> Freeze for MicrokernelServer<P, S, M>
where S: Freeze, M: Freeze, P: Freeze,

§

impl<P, S, M = McpServer> !RefUnwindSafe for MicrokernelServer<P, S, M>

§

impl<P, S, M> Send for MicrokernelServer<P, S, M>

§

impl<P, S, M> Sync for MicrokernelServer<P, S, M>

§

impl<P, S, M> Unpin for MicrokernelServer<P, S, M>
where S: Unpin, M: Unpin, P: Unpin,

§

impl<P, S, M = McpServer> !UnwindSafe for MicrokernelServer<P, S, M>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

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 T
where U: From<T>,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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
Source§

impl<T> ErasedDestructor for T
where T: 'static,