Files
continuwuity/src/router/mod.rs
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
1.1 KiB
Rust
Raw Normal View History

2024-05-30 22:38:39 +00:00
mod layers;
mod request;
mod router;
mod run;
mod serve;
2024-04-29 17:41:15 -07:00
2024-05-09 15:59:08 -07:00
extern crate conduit_core as conduit;
2024-04-29 17:41:15 -07:00
use std::{panic::AssertUnwindSafe, pin::Pin, sync::Arc};
2024-04-29 17:41:15 -07:00
use conduit::{Error, Result, Server};
2024-07-27 07:17:07 +00:00
use conduit_service::Services;
use futures::{Future, FutureExt, TryFutureExt};
2024-04-29 17:41:15 -07:00
2024-05-09 15:59:08 -07:00
conduit::mod_ctor! {}
conduit::mod_dtor! {}
2024-07-24 23:01:00 +00:00
conduit::rustc_flags_capture! {}
2024-04-29 17:41:15 -07:00
2024-05-09 15:59:08 -07:00
#[no_mangle]
2024-07-27 07:17:07 +00:00
pub extern "Rust" fn start(server: &Arc<Server>) -> Pin<Box<dyn Future<Output = Result<Arc<Services>>> + Send>> {
AssertUnwindSafe(run::start(server.clone()))
.catch_unwind()
.map_err(Error::from_panic)
.unwrap_or_else(Err)
.boxed()
2024-04-29 17:41:15 -07:00
}
2024-05-09 15:59:08 -07:00
#[no_mangle]
2024-07-27 07:17:07 +00:00
pub extern "Rust" fn stop(services: Arc<Services>) -> Pin<Box<dyn Future<Output = Result<()>> + Send>> {
AssertUnwindSafe(run::stop(services))
.catch_unwind()
.map_err(Error::from_panic)
.unwrap_or_else(Err)
.boxed()
2024-04-29 17:41:15 -07:00
}
2024-05-09 15:59:08 -07:00
#[no_mangle]
2024-07-27 07:17:07 +00:00
pub extern "Rust" fn run(services: &Arc<Services>) -> Pin<Box<dyn Future<Output = Result<()>> + Send>> {
AssertUnwindSafe(run::run(services.clone()))
.catch_unwind()
.map_err(Error::from_panic)
.unwrap_or_else(Err)
.boxed()
2024-04-29 17:41:15 -07:00
}