pub struct OmbracClient { /* private fields */ }Expand description
OmbracClient provides a simple, easy-to-use API for starting and managing the ombrac client using QUIC transport.
This struct hides all transport-specific implementation details and provides a clean interface for external users.
§Example
use ombrac_client::{OmbracClient, ServiceConfig};
use std::sync::Arc;
let config = Arc::new(ServiceConfig {
secret: "my-secret".to_string(),
server: "server.example.com:8080".to_string(),
auth_option: None,
endpoint: Default::default(),
transport: Default::default(),
logging: Default::default(),
});
let client = OmbracClient::build(config).await?;
// ... use client ...
client.shutdown().await;Implementations§
Source§impl OmbracClient
impl OmbracClient
Sourcepub async fn build(config: Arc<ServiceConfig>) -> Result<Self>
pub async fn build(config: Arc<ServiceConfig>) -> Result<Self>
Builds a new client instance from the configuration.
This method:
- Creates a QUIC client from the transport configuration
- Establishes connection with authentication
- Spawns endpoint tasks if configured
- Returns an OmbracClient handle for lifecycle management
§Arguments
config- The service configuration containing transport, endpoint, and secret settings
§Returns
A configured OmbracClient instance ready to use, or an error
if configuration is invalid or client setup fails.
Sourcepub async fn rebind(&self) -> Result<()>
pub async fn rebind(&self) -> Result<()>
Rebind the transport to a new socket to ensure a clean state for reconnection.
pub fn client(&self) -> &Arc<Client<QuicClient, QuicConnection>>
Auto Trait Implementations§
impl Freeze for OmbracClient
impl !RefUnwindSafe for OmbracClient
impl Send for OmbracClient
impl Sync for OmbracClient
impl Unpin for OmbracClient
impl UnsafeUnpin for OmbracClient
impl !UnwindSafe for OmbracClient
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