1
0
Fork 0
mirror of https://forgejo.ellis.link/continuwuation/continuwuity.git synced 2025-08-01 12:48:31 +00:00
continuwuity/src/router/mod.rs

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

mod layers;
mod request;
mod router;
mod run;
mod serve;
extern crate conduit_core as conduit;
use std::{panic::AssertUnwindSafe, pin::Pin, sync::Arc};
use conduit::{Error, Result, Server};
use conduit_service::Services;
use futures::{Future, FutureExt, TryFutureExt};
conduit::mod_ctor! {}
conduit::mod_dtor! {}
conduit::rustc_flags_capture! {}
#[no_mangle]
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()
}
#[no_mangle]
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()
}
#[no_mangle]
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()
}