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, ReconnectPolicy, TopologyConfig, UnbTopology,
47    UnixHosting,
48};
49pub use unb_client::{Endpoint, EndpointSet, TransportKind};
50pub use unb_core::{
51    validate_node_identifier, Detail, ErrorCode, NodeIdentity, Scope as DiscoverScope,
52};
53pub use unb_runtime::{CancellationToken, Pipe, Wire, WsError};
54#[cfg(feature = "hosting")]
55pub use unb_transport::webtransport::{self, SelfSignedIdentity};
56
57#[doc(hidden)]
58pub mod __private {
59    pub use crate::service::{erase_streaming, erase_unary};
60
61    pub fn schema_value<T: schemars::JsonSchema>() -> serde_json::Value {
62        serde_json::to_value(schemars::schema_for!(T)).unwrap_or(serde_json::Value::Null)
63    }
64
65    pub fn combined_error_schema<A: schemars::JsonSchema, B: schemars::JsonSchema>(
66    ) -> serde_json::Value {
67        serde_json::json!({
68            "oneOf": [schema_value::<A>(), schema_value::<B>()],
69        })
70    }
71}