pub struct OmbracServer { /* private fields */ }Expand description
OmbracServer provides a simple, easy-to-use API for starting and managing the ombrac server using QUIC transport.
This struct hides all transport-specific implementation details and provides a clean interface for external users.
§Example
use ombrac_server::{OmbracServer, ServiceConfig};
use std::sync::Arc;
let config = Arc::new(ServiceConfig {
secret: "my-secret".to_string(),
listen: "0.0.0.0:8080".parse()?,
transport: Default::default(),
connection: Default::default(),
logging: Default::default(),
});
let server = OmbracServer::build(config).await?;
// ... use server ...
server.shutdown().await;Implementations§
Source§impl OmbracServer
impl OmbracServer
Sourcepub async fn build(config: Arc<ServiceConfig>) -> Result<Self>
pub async fn build(config: Arc<ServiceConfig>) -> Result<Self>
Builds a new server instance from the configuration.
This method:
- Creates a QUIC server from the transport configuration
- Sets up connection validation using the secret
- Spawns the accept loop in a background task
- Returns an OmbracServer handle for lifecycle management
§Arguments
config- The service configuration containing transport, connection, and secret settings
§Returns
A configured OmbracServer instance ready to accept connections, or an error
if configuration is invalid or server setup fails.
Auto Trait Implementations§
impl Freeze for OmbracServer
impl RefUnwindSafe for OmbracServer
impl Send for OmbracServer
impl Sync for OmbracServer
impl Unpin for OmbracServer
impl UnsafeUnpin for OmbracServer
impl UnwindSafe for OmbracServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more