Skip to main content

unb_server/
lib.rs

1mod builder;
2mod call;
3mod connect;
4mod connection;
5mod discovery;
6pub mod dynamic;
7mod handler;
8#[cfg(feature = "hosting")]
9mod host;
10#[cfg(feature = "hosting")]
11mod identity;
12mod layer;
13mod node;
14mod peer;
15mod service;
16mod session;
17#[cfg(feature = "hosting")]
18mod topology;
19
20pub use builder::{NodeBuilder, Scope};
21pub use call::{Destination, IntoBody, SendExt};
22pub use connect::EndpointDialer;
23pub use connection::{ConnectError, ConnectionStatus, DisconnectReason, PeerConnection};
24pub use handler::{EventStream, HandlerError};
25#[cfg(feature = "hosting")]
26pub use host::{
27    HealthStatus, HostConfig, HostError, Hosting, TcpSecurity, TcpTransport, WebTransportConfig,
28};
29#[cfg(feature = "hosting")]
30pub use identity::ServerIdentity;
31pub use layer::{layer_fn, Layer, LayerFn, Next, Origin, ServiceBody};
32pub use node::Node;
33pub use peer::{
34    peer_layer_fn, InsecureAcceptDeclaredPeerIdentities, PeerLayer, PeerLayerFn, PeerNext,
35    PeerRequest, VerifiedPeer,
36};
37#[cfg(feature = "hosting")]
38pub use rustls;
39pub use service::Request;
40pub use service::{
41    ContractSchema, Handler, HandlerOutput, HandlerService, Operation, OperationContract, Reply,
42    State, States, Streaming,
43};
44#[cfg(feature = "hosting")]
45pub use topology::{
46    accept_unix, connect_unix, ParentLink, TopologyConfig, UnbTopology, UnixHosting,
47};
48pub use unb_client::{Endpoint, EndpointSet, TransportKind};
49pub use unb_core::{
50    validate_node_identifier, Detail, ErrorCode, NodeIdentity, Scope as DiscoverScope,
51};
52pub use unb_runtime::{CancellationToken, Pipe, Wire, WsError};
53#[cfg(feature = "hosting")]
54pub use unb_transport::webtransport::{self, SelfSignedIdentity};
55
56#[doc(hidden)]
57pub mod __private {
58    pub use crate::service::{erase_streaming, erase_unary};
59
60    pub fn schema_value<T: schemars::JsonSchema>() -> serde_json::Value {
61        serde_json::to_value(schemars::schema_for!(T)).unwrap_or(serde_json::Value::Null)
62    }
63
64    pub fn combined_error_schema<A: schemars::JsonSchema, B: schemars::JsonSchema>(
65    ) -> serde_json::Value {
66        serde_json::json!({
67            "oneOf": [schema_value::<A>(), schema_value::<B>()],
68        })
69    }
70}