Files
continuwuity/src/router/mod.rs
T

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

54 lines
1.2 KiB
Rust
Raw Normal View History

#![type_length_limit = "32768"] //TODO: reduce me
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-12-14 21:58:01 -05:00
extern crate conduwuit_core as conduwuit;
2024-04-29 17:41:15 -07:00
use std::{panic::AssertUnwindSafe, pin::Pin, sync::Arc};
2024-04-29 17:41:15 -07:00
2024-12-14 21:58:01 -05:00
use conduwuit::{Error, Result, Server};
use conduwuit_service::Services;
2025-08-31 03:01:06 +01:00
use ctor::{ctor, dtor};
use futures::{Future, FutureExt, TryFutureExt};
2024-04-29 17:41:15 -07:00
2024-12-14 21:58:01 -05:00
conduwuit::mod_ctor! {}
conduwuit::mod_dtor! {}
conduwuit::rustc_flags_capture! {}
2024-04-29 17:41:15 -07:00
#[unsafe(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()
2024-04-29 17:41:15 -07:00
}
#[unsafe(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()
2024-04-29 17:41:15 -07:00
}
#[unsafe(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()
2024-04-29 17:41:15 -07:00
}