Simplify default Result generics.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-07-08 12:08:13 +00:00
parent 8244d78cb2
commit ae707ab465
42 changed files with 95 additions and 115 deletions

View File

@@ -30,7 +30,7 @@ pub extern "Rust" fn start(
#[unsafe(no_mangle)]
pub extern "Rust" fn stop(
services: Arc<Services>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send>> {
) -> Pin<Box<dyn Future<Output = Result> + Send>> {
AssertUnwindSafe(run::stop(services))
.catch_unwind()
.map_err(Error::from_panic)
@@ -41,7 +41,7 @@ pub extern "Rust" fn stop(
#[unsafe(no_mangle)]
pub extern "Rust" fn run(
services: &Arc<Services>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send>> {
) -> Pin<Box<dyn Future<Output = Result> + Send>> {
AssertUnwindSafe(run::run(services.clone()))
.catch_unwind()
.map_err(Error::from_panic)

View File

@@ -16,7 +16,7 @@ use crate::serve;
/// Main loop base
#[tracing::instrument(skip_all)]
pub(crate) async fn run(services: Arc<Services>) -> Result<()> {
pub(crate) async fn run(services: Arc<Services>) -> Result {
let server = &services.server;
debug!("Start");
@@ -70,7 +70,7 @@ pub(crate) async fn start(server: Arc<Server>) -> Result<Arc<Services>> {
/// Async destructions
#[tracing::instrument(skip_all)]
pub(crate) async fn stop(services: Arc<Services>) -> Result<()> {
pub(crate) async fn stop(services: Arc<Services>) -> Result {
debug!("Shutting down...");
#[cfg(all(feature = "systemd", target_os = "linux"))]
@@ -131,9 +131,9 @@ async fn handle_shutdown(server: Arc<Server>, tx: Sender<()>, handle: axum_serve
async fn handle_services_poll(
server: &Arc<Server>,
result: Result<()>,
listener: JoinHandle<Result<()>>,
) -> Result<()> {
result: Result,
listener: JoinHandle<Result>,
) -> Result {
debug!("Service manager finished: {result:?}");
if server.running() {

View File

@@ -13,7 +13,7 @@ pub(super) async fn serve(
app: Router,
handle: ServerHandle,
addrs: Vec<SocketAddr>,
) -> Result<()> {
) -> Result {
let app = app.into_make_service_with_connect_info::<SocketAddr>();
let mut join_set = JoinSet::new();
for addr in &addrs {

View File

@@ -38,7 +38,7 @@ pub(super) async fn serve(
server: &Arc<Server>,
app: Router,
mut shutdown: broadcast::Receiver<()>,
) -> Result<()> {
) -> Result {
let mut tasks = JoinSet::<()>::new();
let executor = TokioExecutor::new();
let app = app.into_make_service_with_connect_info::<net::SocketAddr>();