Struct ConnectBuilder
pub struct ConnectBuilder<T = TungsteniteTransport, C = JsonCodec> { /* private fields */ }Expand description
Builder for advanced connection configuration.
Allows customizing the transport and codec used for the connection. Defaults to TungsteniteTransport + JsonCodec.
§Example
use gemini_genai_rs::prelude::*;
let config = SessionConfig::new("key");
let handle = ConnectBuilder::new(config)
.transport_config(TransportConfig { connect_timeout_secs: 30, ..Default::default() })
.build()
.await
.unwrap();Implementations§
§impl ConnectBuilder
impl ConnectBuilder
pub fn new(config: SessionConfig) -> ConnectBuilder
pub fn new(config: SessionConfig) -> ConnectBuilder
Create a new builder with default transport and codec.
§impl<T, C> ConnectBuilder<T, C>
impl<T, C> ConnectBuilder<T, C>
pub fn transport_config(self, tc: TransportConfig) -> ConnectBuilder<T, C>
pub fn transport_config(self, tc: TransportConfig) -> ConnectBuilder<T, C>
Set the transport configuration.
pub fn transport<T2>(self, transport: T2) -> ConnectBuilder<T2, C>where
T2: Transport,
pub fn transport<T2>(self, transport: T2) -> ConnectBuilder<T2, C>where
T2: Transport,
Use a custom transport implementation.
pub fn codec<C2>(self, codec: C2) -> ConnectBuilder<T, C2>where
C2: Codec,
pub fn codec<C2>(self, codec: C2) -> ConnectBuilder<T, C2>where
C2: Codec,
Use a custom codec implementation.
pub async fn build(self) -> Result<SessionHandle, SessionError>
pub async fn build(self) -> Result<SessionHandle, SessionError>
Build the connection and return a SessionHandle.
Auto Trait Implementations§
impl<T, C> Freeze for ConnectBuilder<T, C>
impl<T, C> RefUnwindSafe for ConnectBuilder<T, C>where
T: RefUnwindSafe,
C: RefUnwindSafe,
impl<T, C> Send for ConnectBuilder<T, C>
impl<T, C> Sync for ConnectBuilder<T, C>
impl<T, C> Unpin for ConnectBuilder<T, C>
impl<T, C> UnwindSafe for ConnectBuilder<T, C>where
T: UnwindSafe,
C: UnwindSafe,
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