citum_server/lib.rs
1/*
2SPDX-License-Identifier: MIT OR Apache-2.0
3SPDX-FileCopyrightText: © 2023-2026 Bruce D'Arcus
4*/
5
6//! Citum JSON-RPC Server
7//!
8//! This crate provides a JSON-RPC server for citation and bibliography processing.
9//! It wraps the `citum-engine` functionality in a request-response protocol suitable
10//! for use with word processors, web applications, and other clients.
11//!
12//! ## Modes
13//!
14//! The server supports two transport modes:
15//!
16//! - **stdio (default)**: Newline-delimited JSON-RPC on stdin/stdout. No runtime overhead.
17//! - **HTTP (optional, requires `http` feature)**: Exposes `/rpc` endpoint via axum.
18//!
19//! ## Example (stdio mode)
20//!
21//! ```bash
22//! echo '{"id": 1, "method": "validate_style", "params": {"style_path": "path/to/style.yaml"}}' \
23//! | citum-server
24//! ```
25//!
26//! ## Features
27//!
28//! - `async`: Enable tokio runtime (required for HTTP)
29//! - `http`: Enable HTTP server (implies async)
30
31/// Server error types and conversions.
32pub mod error;
33/// JSON-RPC request handling and stdio transport.
34pub mod rpc;
35
36#[cfg(feature = "http")]
37/// Optional HTTP transport built on axum.
38pub mod http;
39
40pub use error::ServerError;
41pub use rpc::dispatch;