### ClientConfig::start_session Source: https://docs.rs/quinn/0.11.8/quinn/crypto/trait.ClientConfig.html Starts a client session with the given version, server name, and transport parameters. ```APIDOC ## fn start_session( self: Arc, version: u32, server_name: &str, params: &TransportParameters, ) -> Result, ConnectError> ### Description Start a client session with this configuration ### Parameters - **self**: Arc - **version**: u32 - **server_name**: &str - **params**: &TransportParameters ### Returns Result, ConnectError> ``` -------------------------------- ### QuicClientConfig::start_session Source: https://docs.rs/quinn/0.11.8/quinn/crypto/rustls/struct.QuicClientConfig.html Starts a client session with the given configuration, version, server name, and transport parameters. ```APIDOC ## QuicClientConfig::start_session ### Description Start a client session with this configuration. ### Signature ```rust fn start_session( self: Arc, version: u32, server_name: &str, params: &TransportParameters, ) -> Result, ConnectError> ``` ### Parameters - `self`: An `Arc` representing the client configuration. - `version`: The QUIC version to use for the session. - `server_name`: The hostname of the server to connect to. - `params`: The transport parameters for the connection. ### Returns A `Result` which is `Ok(Box)` on success, or `Err(ConnectError)` if the session could not be started. ``` -------------------------------- ### ClientConfig for QuicClientConfig - start_session Source: https://docs.rs/quinn/0.11.8/quinn/crypto/rustls/struct.QuicClientConfig.html Starts a client session with the given configuration, version, server name, and transport parameters. ```rust fn start_session( self: Arc, version: u32, server_name: &str, params: &TransportParameters, ) -> Result, ConnectError> ``` -------------------------------- ### Start QUIC server session Source: https://docs.rs/quinn/0.11.8/quinn/crypto/rustls/struct.QuicServerConfig.html Initiates a server session with the given `QuicServerConfig`, transport version, and parameters. Returns a boxed `Session` trait object. ```rust fn start_session(self: Arc, version: u32, params: &TransportParameters) -> Box ``` -------------------------------- ### start_session Method Source: https://docs.rs/quinn/0.11.8/quinn/crypto/trait.ServerConfig.html Initiates a new server session with the provided transport parameters and QUIC version. This method is called after successful key negotiation and is never invoked if initial_keys rejected the version. ```rust fn start_session( self: Arc, version: u32, params: &TransportParameters, ) -> Box ``` -------------------------------- ### Get Type ID Source: https://docs.rs/quinn/0.11.8/quinn/congestion/struct.CubicConfig.html Gets the TypeId of the CubicConfig instance. This is part of the Any trait implementation. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### start_session Source: https://docs.rs/quinn/0.11.8/quinn/crypto/trait.ServerConfig.html Initiates a new server session with the given QUIC version and transport parameters. This method is called after successful key negotiation and is only invoked if initial_keys did not reject the version. ```APIDOC ## fn start_session ### Description Start a server session with this configuration. Never called if `initial_keys` rejected `version`. ### Parameters - **version** (u32) - The QUIC version for the session. - **params** (&TransportParameters) - The transport parameters negotiated with the client. ### Returns - Box - A boxed trait object representing the started server session. ``` -------------------------------- ### Start a Work Cycle Source: https://docs.rs/quinn/0.11.8/src/quinn/work_limiter.rs.html Resets the completed work count for the current cycle. If in measurement mode, it records the start time. ```rust pub(crate) fn start_cycle(&mut self, now: impl Fn() -> Instant) { self.completed = 0; if let Mode::Measure = self.mode { self.start_time = Some(now()); } } ``` -------------------------------- ### Get the Last Element of a Slice Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionId.html Use `last` to get an immutable reference to the last element. Returns `None` if the slice is empty. ```rust let v = [10, 40, 30]; assert_eq!(Some(&30), v.last()); let w: &[i32] = &[]; assert_eq!(None, w.last()); ``` -------------------------------- ### Get the Last N Elements as an Array Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionId.html Use `last_chunk` to get an immutable reference to the last `N` elements as an array. Returns `None` if the slice is shorter than `N`. ```rust let x = &[0, 1, 2]; // Example usage would go here, but is not provided in the source. ``` -------------------------------- ### Get the First N Elements as an Array Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionId.html Use `first_chunk` to get an immutable reference to the first `N` elements as an array. Returns `None` if the slice is shorter than `N`. ```rust let u = [10, 40, 30]; assert_eq!(Some(&[10, 40]), u.first_chunk::<2>()); let v: &[i32] = &[10]; assert_eq!(None, v.first_chunk::<2>()); let w: &[i32] = &[]; assert_eq!(Some(&[]), w.first_chunk::<0>()); ``` -------------------------------- ### Get a Mutable Reference to the Last Element of a Slice Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionId.html Use `last_mut` to get a mutable reference to the last element. Returns `None` if the slice is empty. Modifies the slice in place. ```rust let x = &mut [0, 1, 2]; if let Some(last) = x.last_mut() { *last = 10; } assert_eq!(x, &[0, 1, 10]); let y: &mut [i32] = &mut []; assert_eq!(None, y.last_mut()); ``` -------------------------------- ### Initialize a new Quinn connection attempt Source: https://docs.rs/quinn/0.11.8/src/quinn/connection.rs.html Creates a new `Connecting` instance to manage an in-progress connection. It spawns a `ConnectionDriver` to handle the underlying I/O and connection logic. ```rust pub(crate) fn new( handle: ConnectionHandle, conn: proto::Connection, endpoint_events: mpsc::UnboundedSender<(ConnectionHandle, EndpointEvent)>, conn_events: mpsc::UnboundedReceiver, socket: Arc, runtime: Arc, ) -> Self { let (on_handshake_data_send, on_handshake_data_recv) = oneshot::channel(); let (on_connected_send, on_connected_recv) = oneshot::channel(); let conn = ConnectionRef::new( handle, conn, endpoint_events, conn_events, on_handshake_data_send, on_connected_send, socket, runtime.clone(), ); let driver = ConnectionDriver(conn.clone()); runtime.spawn(Box::pin( async { if let Err(e) = driver.await { tracing::error!("I/O error: {e}"); } } .instrument(Span::current()) )); Self { conn: Some(conn), connected: on_connected_recv, handshake_data_ready: Some(on_handshake_data_recv), } } ``` -------------------------------- ### Get the First N Elements Mutably as an Array Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionId.html Use `first_chunk_mut` to get a mutable reference to the first `N` elements as an array. Returns `None` if the slice is shorter than `N`. Modifies the slice in place. ```rust let x = &mut [0, 1, 2]; if let Some(first) = x.first_chunk_mut::<2>() { first[0] = 5; first[1] = 4; } assert_eq!(x, &[5, 4, 2]); assert_eq!(None, x.first_chunk_mut::<4>()); ``` -------------------------------- ### T::type_id Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionId.html Gets the `TypeId` of a type. ```APIDOC ## T::type_id ### Description Gets the `TypeId` of `self`. ### Method type_id(&self) -> TypeId ``` -------------------------------- ### ServerConfig::new Source: https://docs.rs/quinn/0.11.8/quinn/struct.ServerConfig.html Creates a default ServerConfig with a specified handshake token key. ```APIDOC ## ServerConfig::new ### Description Create a default config with a particular handshake token key. ### Signature ```rust pub fn new( crypto: Arc, token_key: Arc, ) -> ServerConfig ``` ### Parameters * `crypto`: `Arc` - TLS configuration used for incoming connections. Must be set to use TLS 1.3 only. * `token_key`: `Arc` - Private key used to authenticate data included in handshake tokens. ``` -------------------------------- ### Initialize QuicServerConfig with initial cipher suite Source: https://docs.rs/quinn/0.11.8/quinn/crypto/rustls/struct.QuicServerConfig.html Use `with_initial` to initialize a `QuicServerConfig` with a separate initial cipher suite, useful for avoiding it for traffic encryption. Requires an `Arc` and a `Suite`. ```rust pub fn with_initial( inner: Arc, initial: Suite, ) -> Result ``` -------------------------------- ### id Source: https://docs.rs/quinn/0.11.8/quinn/struct.SendStream.html Gets the identity of this stream. ```APIDOC ## id ### Description Get the identity of this stream. ### Method `fn id(&self) -> StreamId` ### Response * `StreamId` - The unique identifier for this stream. ``` -------------------------------- ### Split Off Slice Starting with Third Element Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionId.html Use `split_off` with a range `2..` to remove and return a reference to the subslice starting from the third element. The original slice is modified to contain the elements before the split point. ```rust let mut slice: &[_] = &['a', 'b', 'c', 'd']; let mut tail = slice.split_off(2..).unwrap(); assert_eq!(slice, &['a', 'b']); assert_eq!(tail, &['c', 'd']); ``` -------------------------------- ### TryFrom for QuicServerConfig Source: https://docs.rs/quinn/0.11.8/quinn/crypto/rustls/struct.QuicServerConfig.html Attempts to convert a `ServerConfig` into a `QuicServerConfig`. This is an alternative to using `Arc` for conversion. ```APIDOC ### impl TryFrom for QuicServerConfig #### type Error = NoInitialCipherSuite #### fn try_from( inner: ServerConfig, ) -> Result>::Error> ### Description Performs the conversion from a `ServerConfig` to a `QuicServerConfig`. ### Parameters * `inner`: A `ServerConfig` to convert. ### Returns A `Result` which is either `Ok(QuicServerConfig)` on success or `Err(NoInitialCipherSuite)` if the conversion fails. ``` -------------------------------- ### ClientConfig::new Source: https://docs.rs/quinn/0.11.8/quinn/struct.ClientConfig.html Creates a default ClientConfig with a specified cryptographic configuration. This is the primary way to initialize a client configuration. ```APIDOC ## `ClientConfig::new` ### Description Create a default config with a particular cryptographic config. ### Signature `pub fn new(crypto: Arc) -> ClientConfig` ### Parameters * `crypto` (Arc) - The cryptographic configuration to use for the client. ``` -------------------------------- ### Split Off Mutable Slice Starting with Third Element Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionId.html Use `split_off_mut` with a range `2..` to remove and return a mutable reference to the subslice starting from the third element. The original mutable slice is modified to contain the elements before the split point. ```rust let mut slice: &mut [_] = &mut ['a', 'b', 'c', 'd']; let mut tail = slice.split_off_mut(2..).unwrap(); assert_eq!(slice, &mut ['a', 'b']); assert_eq!(tail, &mut ['c', 'd']); ``` -------------------------------- ### Get Endpoint Statistics Source: https://docs.rs/quinn/0.11.8/quinn/struct.Endpoint.html Retrieves relevant statistics from the Endpoint. ```rust pub fn stats(&self) -> EndpointStats ``` -------------------------------- ### Async-Std Runtime Implementation for Quinn Source: https://docs.rs/quinn/0.11.8/src/quinn/runtime/async_io.rs.html Provides a Quinn runtime implementation using the 'async-std' asynchronous I/O library. This includes creating timers, spawning tasks, and wrapping UDP sockets for use with Quinn. ```rust pub struct AsyncStdRuntime; impl Runtime for AsyncStdRuntime { fn new_timer(&self, t: Instant) -> Pin> { Box::pin(Timer::at(t)) } fn spawn(&self, future: Pin + Send>>) { ::async_std::task::spawn(future); } fn wrap_udp_socket( &self, sock: std::net::UdpSocket, ) -> io::Result> { Ok(Arc::new(UdpSocket::new(sock)?)) } } ``` -------------------------------- ### strip_prefix Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionId.html Returns a subslice with the prefix removed. If the slice starts with `prefix`, returns the subslice after the prefix, wrapped in `Some`. If `prefix` is empty, simply returns the original slice. If `prefix` is equal to the original slice, returns an empty slice. If the slice does not start with `prefix`, returns `None`. ```APIDOC ## strip_prefix

(&self, prefix: &P) -> Option<&[T]> ### Description Returns a subslice with the prefix removed. If the slice starts with `prefix`, returns the subslice after the prefix, wrapped in `Some`. If `prefix` is empty, simply returns the original slice. If `prefix` is equal to the original slice, returns an empty slice. If the slice does not start with `prefix`, returns `None`. ### Method `strip_prefix` ### Parameters #### Path Parameters - `prefix` (&P) - Required - The prefix to remove. `P` must implement `SlicePattern` and `?Sized`, and `T` must implement `PartialEq`. ### Request Example ```rust let v = &[10, 40, 30]; assert_eq!(v.strip_prefix(&[10]), Some(&[40, 30][..])); assert_eq!(v.strip_prefix(&[10, 40]), Some(&[30][..])); assert_eq!(v.strip_prefix(&[10, 40, 30]), Some(&[][..])); assert_eq!(v.strip_prefix(&[50]), None); assert_eq!(v.strip_prefix(&[10, 50]), None); let prefix : &str = "he"; assert_eq!(b"hello".strip_prefix(prefix.as_bytes()), Some(b"llo".as_ref())); ``` ### Response #### Success Response (Option) - `Option<&[T]>` - A subslice with the prefix removed, or `None` if the slice does not start with the prefix. ``` -------------------------------- ### Smol Runtime Implementation for Quinn Source: https://docs.rs/quinn/0.11.8/src/quinn/runtime/async_io.rs.html Provides a Quinn runtime implementation using the 'smol' asynchronous I/O library. This includes creating timers, spawning tasks, and wrapping UDP sockets for use with Quinn. ```rust pub struct SmolRuntime; impl Runtime for SmolRuntime { fn new_timer(&self, t: Instant) -> Pin> { Box::pin(Timer::at(t)) } fn spawn(&self, future: Pin + Send>>) { ::smol::spawn(future).detach(); } fn wrap_udp_socket( &self, sock: std::net::UdpSocket, ) -> io::Result> { Ok(Arc::new(UdpSocket::new(sock)?)) } } ``` -------------------------------- ### Get Remote Address Source: https://docs.rs/quinn/0.11.8/src/quinn/incoming.rs.html Retrieves the UDP socket address of the peer. ```rust pub fn remote_address(&self) -> SocketAddr { self.0.as_ref().unwrap().inner.remote_address() } ``` -------------------------------- ### Connect with Custom Client Configuration Source: https://docs.rs/quinn/0.11.8/quinn/struct.Endpoint.html Initiates a connection to a remote endpoint using a specific client configuration. See `connect()` for details on `server_name` and potential failures. ```rust pub fn connect_with( &self, config: ClientConfig, addr: SocketAddr, server_name: &str, ) -> Result ``` -------------------------------- ### Build Controller from BbrConfig Source: https://docs.rs/quinn/0.11.8/quinn/congestion/struct.BbrConfig.html Constructs a fresh Controller instance using the BbrConfig, current time, and MTU. ```rust fn build( self: Arc, _now: Instant, current_mtu: u16, ) -> Box ``` -------------------------------- ### Get SendStream ID Source: https://docs.rs/quinn/0.11.8/quinn/struct.SendStream.html Retrieves the unique identifier for this send stream. ```rust pub fn id(&self) -> StreamId ``` -------------------------------- ### iter Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionId.html Returns an iterator over the slice, yielding items from start to end. ```APIDOC ## iter ### Description Returns an iterator over the slice. The iterator yields all items from start to end. ### Returns Iter<'_, T>: An iterator over the slice elements. ``` -------------------------------- ### Create Default ServerConfig Source: https://docs.rs/quinn/0.11.8/quinn/struct.ServerConfig.html Initializes a ServerConfig with default transport and crypto settings, using a provided handshake token key. This is the entry point for creating a new server configuration. ```rust pub fn new( crypto: Arc, token_key: Arc, ) -> ServerConfig ``` -------------------------------- ### Get Open Connections Count Source: https://docs.rs/quinn/0.11.8/src/quinn/endpoint.rs.html Returns the number of connections that are currently open. ```APIDOC ## open_connections ### Description Get the number of connections that are currently open. ### Method `pub fn open_connections(&self) -> usize` ### Parameters None ### Request Example None ### Response #### Success Response (200) - **usize** - The count of open connections. #### Response Example None ``` -------------------------------- ### TryFrom> for QuicServerConfig Source: https://docs.rs/quinn/0.11.8/quinn/crypto/rustls/struct.QuicServerConfig.html Attempts to convert an `Arc` into a `QuicServerConfig`. This conversion is necessary for using custom rustls server configurations with Quinn. ```APIDOC ### impl TryFrom> for QuicServerConfig #### type Error = NoInitialCipherSuite #### fn try_from( inner: Arc, ) -> Result>>::Error> ### Description Performs the conversion from an `Arc` to a `QuicServerConfig`. ### Parameters * `inner`: An `Arc` to convert. ### Returns A `Result` which is either `Ok(QuicServerConfig)` on success or `Err(NoInitialCipherSuite)` if the conversion fails. ``` -------------------------------- ### QuicServerConfig::with_initial Source: https://docs.rs/quinn/0.11.8/quinn/crypto/rustls/struct.QuicServerConfig.html Initializes a QUIC-compatible TLS server configuration with a separate initial cipher suite. This is useful if you want to avoid the initial cipher suite for traffic encryption. ```APIDOC ## pub fn with_initial( inner: Arc, initial: Suite, ) -> Result ### Description Initialize a QUIC-compatible TLS client configuration with a separate initial cipher suite This is useful if you want to avoid the initial cipher suite for traffic encryption. ### Parameters * `inner`: An `Arc` representing the underlying TLS server configuration. * `initial`: A `Suite` representing the separate initial cipher suite. ### Returns A `Result` which is either `Ok(QuicServerConfig)` on success or `Err(NoInitialCipherSuite)` if the initial cipher suite is not supported. ``` -------------------------------- ### Get Local Address Source: https://docs.rs/quinn/0.11.8/src/quinn/endpoint.rs.html Retrieves the local `SocketAddr` the underlying socket is bound to. ```APIDOC ## local_addr ### Description Get the local `SocketAddr` the underlying socket is bound to. ### Method `pub fn local_addr(&self) -> io::Result` ### Parameters None ### Request Example None ### Response #### Success Response (200) - **SocketAddr** - The local socket address. #### Response Example None ``` -------------------------------- ### initial_keys Method Source: https://docs.rs/quinn/0.11.8/quinn/crypto/trait.ServerConfig.html Generates the initial set of cryptographic keys for a server connection. This method is called with the client's initial destination ConnectionId and the QUIC version. ```rust fn initial_keys( &self, version: u32, dst_cid: &ConnectionId, ) -> Result ``` -------------------------------- ### Any Trait Implementation Source: https://docs.rs/quinn/0.11.8/quinn/struct.ValidationTokenConfig.html Provides the `type_id` method to get the unique identifier of a type. ```APIDOC ## fn type_id(&self) -> TypeId Gets the `TypeId` of `self`. ``` -------------------------------- ### Get Original Destination CID Source: https://docs.rs/quinn/0.11.8/src/quinn/incoming.rs.html Retrieves the Connection ID used when initiating the connection. ```rust pub fn orig_dst_cid(&self) -> ConnectionId { *self.0.as_ref().unwrap().inner.orig_dst_cid() } ``` -------------------------------- ### initial_window Method Source: https://docs.rs/quinn/0.11.8/quinn/congestion/trait.Controller.html Returns the initial congestion window size. This value is used when a new connection is established. ```rust fn initial_window(&self) -> u64; ``` -------------------------------- ### Get Open Connections Count Source: https://docs.rs/quinn/0.11.8/quinn/struct.Endpoint.html Returns the number of connections that are currently open on this endpoint. ```rust pub fn open_connections(&self) -> usize ``` -------------------------------- ### Generate initial QUIC keys Source: https://docs.rs/quinn/0.11.8/quinn/crypto/rustls/struct.QuicServerConfig.html Creates the initial set of cryptographic keys required for a QUIC connection, based on the server configuration, protocol version, and the client's initial destination Connection ID. ```rust fn initial_keys(&self, version: u32, dst_cid: &ConnectionId) -> Result ``` -------------------------------- ### Get the length of the ConnectionId slice Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionId.html Returns the number of elements (bytes) in the ConnectionId slice. ```rust pub fn len(&self) -> usize ``` ```rust let a = [1, 2, 3]; assert_eq!(a.len(), 3); ``` -------------------------------- ### Accept Incoming Connection with Custom Configuration Source: https://docs.rs/quinn/0.11.8/src/quinn/incoming.rs.html Accepts an incoming connection using a custom server configuration. This allows for fine-grained control over connection parameters. ```rust pub fn accept_with( mut self, server_config: Arc, ) -> Result { let state = self.0.take().unwrap(); state.endpoint.accept(state.inner, Some(server_config)) } ``` -------------------------------- ### Endpoint::new Source: https://docs.rs/quinn/0.11.8/quinn/struct.Endpoint.html Constructs an endpoint with custom configuration, an optional server configuration, a UDP socket, and a runtime. ```APIDOC ## Endpoint::new ### Description Construct an endpoint with arbitrary configuration and socket. ### Method `pub fn new( config: EndpointConfig, server_config: Option, socket: UdpSocket, runtime: Arc, ) -> Result` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) `Self` (an Endpoint instance) #### Response Example None ``` -------------------------------- ### Get SendStream ID Source: https://docs.rs/quinn/0.11.8/src/quinn/send_stream.rs.html The `id()` method returns the unique identifier (`StreamId`) for this send stream. ```rust pub fn id(&self) -> StreamId { self.stream } ``` -------------------------------- ### initial_keys Source: https://docs.rs/quinn/0.11.8/quinn/crypto/trait.ServerConfig.html Creates the initial set of keys required for a secure connection, using the provided version and the client's destination ConnectionId. ```APIDOC ## fn initial_keys ### Description Create the initial set of keys given the client’s initial destination ConnectionId. ### Parameters - **version** (u32) - The QUIC version. - **dst_cid** (&ConnectionId) - The client's initial destination ConnectionId. ### Returns - Result - A Result containing the generated Keys or an UnsupportedVersion error. ``` -------------------------------- ### remote_address Source: https://docs.rs/quinn/0.11.8/src/quinn/connection.rs.html Gets the UDP address of the peer. This method will panic if called after the connection has yielded `Ready`. ```APIDOC ## remote_address ### Description Gets the UDP address of the peer. This method will panic if called after the connection has yielded `Ready`. ### Method `remote_address(&self) -> SocketAddr` ### Returns - `SocketAddr`: The peer's UDP address. ``` -------------------------------- ### QuicClientConfig::with_initial Source: https://docs.rs/quinn/0.11.8/quinn/crypto/rustls/struct.QuicClientConfig.html Initializes a QUIC-compatible TLS client configuration with a separate initial cipher suite. This is useful if you want to avoid the initial cipher suite for traffic encryption. ```APIDOC ## QuicClientConfig::with_initial ### Description Initialize a QUIC-compatible TLS client configuration with a separate initial cipher suite This is useful if you want to avoid the initial cipher suite for traffic encryption. ### Signature ```rust pub fn with_initial( inner: Arc, initial: Suite, ) -> Result ``` ### Parameters - `inner`: An `Arc` representing the inner TLS client configuration. - `initial`: A `Suite` representing the initial cipher suite. ### Returns A `Result` which is `Ok(QuicClientConfig)` on success, or `Err(NoInitialCipherSuite)` if the initial cipher suite is not supported. ``` -------------------------------- ### Get SendStream Priority Source: https://docs.rs/quinn/0.11.8/quinn/struct.SendStream.html Retrieves the current priority of the send stream. The default priority is 0. ```rust pub fn priority(&self) -> Result ``` -------------------------------- ### Get Local Socket Address Source: https://docs.rs/quinn/0.11.8/quinn/struct.Endpoint.html Retrieves the local `SocketAddr` that the underlying UDP socket is bound to. ```rust pub fn local_addr(&self) -> Result ``` -------------------------------- ### CubicConfig::build Source: https://docs.rs/quinn/0.11.8/quinn/congestion/struct.CubicConfig.html Constructs a fresh `Controller` instance using the provided `CubicConfig`, current time, and MTU. ```APIDOC ## fn build( self: Arc, now: Instant, current_mtu: u16, ) -> Box ### Description Construct a fresh `Controller` ``` -------------------------------- ### TryFrom for QuicClientConfig Source: https://docs.rs/quinn/0.11.8/quinn/crypto/rustls/struct.QuicClientConfig.html Enables conversion from a ClientConfig to QuicClientConfig. This conversion may fail if specific TLS requirements are not met. ```rust type Error = NoInitialCipherSuite ``` ```rust fn try_from( inner: ClientConfig, ) -> Result>::Error> ``` -------------------------------- ### Get Peer Identity Source: https://docs.rs/quinn/0.11.8/quinn/crypto/trait.Session.html Retrieves the identity of the peer, if available. This is typically used after the handshake is complete. ```rust fn peer_identity(&self) -> Option>; ``` -------------------------------- ### TokioRuntime Source: https://docs.rs/quinn/0.11.8/quinn/struct.TokioRuntime.html A Quinn runtime for Tokio. ```APIDOC ## struct TokioRuntime A Quinn runtime for Tokio. ### Methods #### `new_timer(&self, t: Instant) -> Pin>` Construct a timer that will expire at `i`. #### `spawn(&self, future: Pin + Send>>)` Drive `future` to completion in the background. #### `wrap_udp_socket(&self, sock: UdpSocket) -> Result>` Convert `t` into the socket type used by this runtime. #### `now(&self) -> Instant` Look up the current time. ``` -------------------------------- ### iter_mut Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionId.html Returns an iterator that allows modifying each value in the slice, yielding items from start to end. ```APIDOC ## iter_mut ### Description Returns an iterator that allows modifying each value. The iterator yields all items from start to end. ### Returns IterMut<'_, T>: A mutable iterator over the slice elements. ``` -------------------------------- ### Initialize QuicClientConfig with initial cipher suite Source: https://docs.rs/quinn/0.11.8/quinn/crypto/rustls/struct.QuicClientConfig.html Use this function to initialize a QUIC-compatible TLS client configuration with a separate initial cipher suite, useful for avoiding the initial cipher suite for traffic encryption. ```rust pub fn with_initial( inner: Arc, initial: Suite, ) -> Result ``` -------------------------------- ### get Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionId.html Returns a reference to an element or subslice based on the index type. Returns `None` if the index is out of bounds. ```APIDOC ## get ### Description Returns a reference to an element or subslice depending on the type of index. If given a position, returns a reference to the element at that position or `None` if out of bounds. If given a range, returns the subslice corresponding to that range, or `None` if out of bounds. ### Method `get(index: I)` ### Parameters * `index` (I): A position or range to access within the slice. `I` must implement `SliceIndex<[T]>`. ### Response * `Option<&>::Output>`: A reference to the element or subslice, or `None` if out of bounds. ### Example ```rust let v = [10, 40, 30]; assert_eq!(Some(&40), v.get(1)); assert_eq!(Some(&[10, 40][..]), v.get(0..2)); assert_eq!(None, v.get(3)); assert_eq!(None, v.get(0..4)); ``` ``` -------------------------------- ### NewReno::new Source: https://docs.rs/quinn/0.11.8/quinn/congestion/struct.NewReno.html Constructs a new NewReno congestion controller state. ```APIDOC ## NewReno::new ### Description Construct a state using the given `config` and current time `now`. ### Signature ```rust pub fn new( config: Arc, now: Instant, current_mtu: u16, ) -> NewReno ``` ### Parameters * `config` (Arc) - Configuration for the NewReno controller. * `now` (Instant) - The current time. * `current_mtu` (u16) - The current Maximum Transmission Unit. ``` -------------------------------- ### Get Local IP Address Source: https://docs.rs/quinn/0.11.8/src/quinn/incoming.rs.html Retrieves the local IP address used when the peer established the connection. ```rust pub fn local_ip(&self) -> Option { self.0.as_ref().unwrap().inner.local_ip() } ``` -------------------------------- ### Build a new Controller Instance Source: https://docs.rs/quinn/0.11.8/quinn/congestion/trait.ControllerFactory.html Constructs a fresh `Controller` instance. This method is called by the quinn library to obtain a new controller for a connection. ```rust fn build( self: Arc, now: Instant, current_mtu: u16, ) -> Box ``` -------------------------------- ### TryFrom> for QuicClientConfig Source: https://docs.rs/quinn/0.11.8/quinn/crypto/rustls/struct.QuicClientConfig.html Enables conversion from an Arc to QuicClientConfig. This conversion may fail if specific TLS requirements are not met. ```rust type Error = NoInitialCipherSuite ``` ```rust fn try_from( inner: Arc, ) -> Result>>::Error> ``` -------------------------------- ### ServerConfig::time_source Source: https://docs.rs/quinn/0.11.8/quinn/struct.ServerConfig.html Sets the object used to get the current system time, useful for mocking in tests. ```APIDOC ## ServerConfig::time_source ### Description Object to get current `SystemTime`. This exists to allow system time to be mocked in tests, or wherever else desired. Defaults to `StdSystemTime`, which simply calls `SystemTime::now()`. ### Signature ```rust pub fn time_source( &mut self, time_source: Arc, ) -> &mut ServerConfig ``` ### Parameters * `time_source`: `Arc` - An object implementing the `TimeSource` trait. ``` -------------------------------- ### EndpointConfig::new Source: https://docs.rs/quinn/0.11.8/quinn/struct.EndpointConfig.html Creates a default EndpointConfig with a specified reset key. This is the primary way to initialize the configuration. ```APIDOC ## EndpointConfig::new ### Description Create a default config with a particular `reset_key`. ### Signature `pub fn new(reset_key: Arc) -> EndpointConfig` ``` -------------------------------- ### priority Source: https://docs.rs/quinn/0.11.8/quinn/struct.SendStream.html Gets the current priority of the send stream. This operation may fail if the stream is already closed. ```APIDOC ## priority ### Description Get the priority of the send stream. ### Method `fn priority(&self) -> Result` ### Response * `Result` - On success, returns the current priority as an `i32`. On failure, returns a `ClosedStream` error. ``` -------------------------------- ### Get StreamId Initiator Source: https://docs.rs/quinn/0.11.8/quinn/struct.StreamId.html Returns the Side that initiated the stream. This helps determine which endpoint created the stream. ```rust pub fn initiator(self) -> Side ``` -------------------------------- ### Incoming Connection Methods Source: https://docs.rs/quinn/0.11.8/quinn/struct.Incoming.html Provides methods to manage and query the state of an incoming connection before the handshake is complete. ```APIDOC ## Incoming Connection Methods ### Description An incoming connection for which the server has not yet begun its part of the handshake. This struct provides methods to accept, refuse, or retry the connection, as well as retrieve details about the connection. ### Methods #### `accept()` - **Description**: Attempts to accept this incoming connection. An error may still occur during the handshake process. - **Returns**: `Result` #### `accept_with(server_config: Arc)` - **Description**: Accepts this incoming connection using a custom server configuration. See `accept()` for more details. - **Parameters**: - `server_config` (Arc) - The custom server configuration to use. - **Returns**: `Result` #### `refuse()` - **Description**: Rejects this incoming connection attempt without sending any specific response packet. #### `retry()` - **Description**: Responds with a retry packet, requiring the client to retry with address validation. Errors if `may_retry()` is false. - **Returns**: `Result<(), RetryError>` #### `ignore()` - **Description**: Ignores this incoming connection attempt, not sending any packet in response. #### `local_ip()` - **Description**: Returns the local IP address that was used when the peer established the connection. - **Returns**: `Option` #### `remote_address()` - **Description**: Returns the peer's UDP address. - **Returns**: `SocketAddr` #### `remote_address_validated()` - **Description**: Checks whether the socket address initiating this connection has been validated. This means the sender has proved they can receive traffic sent to `self.remote_address()`. - **Returns**: `bool` #### `may_retry()` - **Description**: Checks whether it is legal to respond with a retry packet. If `self.remote_address_validated()` is false, `self.may_retry()` is guaranteed to be true. - **Returns**: `bool` #### `orig_dst_cid()` - **Description**: Returns the original destination CID when initiating the connection. - **Returns**: `ConnectionId` ``` -------------------------------- ### Build Controller from CubicConfig Source: https://docs.rs/quinn/0.11.8/quinn/congestion/struct.CubicConfig.html Constructs a fresh Controller instance using the CubicConfig, current time, and MTU. ```rust fn build( self: Arc, now: Instant, current_mtu: u16, ) -> Box ``` -------------------------------- ### Get Remote Address Source: https://docs.rs/quinn/0.11.8/quinn/struct.Connecting.html Retrieves the UDP address of the peer. Panics if called after `poll` has returned `Ready`. ```rust pub fn remote_address(&self) -> SocketAddr ``` -------------------------------- ### Create ClientConfig trusting platform roots Source: https://docs.rs/quinn/0.11.8/quinn/struct.ClientConfig.html Constructs a `ClientConfig` that uses the operating system's native certificate store for verifying peer identities. This is a convenient option for trusting system-wide CAs. ```rust pub fn with_platform_verifier() -> ClientConfig ``` -------------------------------- ### Iterate Over Slice Elements Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionId.html Provides an iterator that yields immutable references to each element in the slice from start to end. ```rust let x = &[1, 2, 4]; let mut iterator = x.iter(); assert_eq!(iterator.next(), Some(&1)); assert_eq!(iterator.next(), Some(&2)); assert_eq!(iterator.next(), Some(&4)); assert_eq!(iterator.next(), None); ``` -------------------------------- ### WorkLimiter::start_cycle Source: https://docs.rs/quinn/0.11.8/src/quinn/work_limiter.rs.html Resets the completed work count for the current cycle and starts timing if in measurement mode. ```APIDOC ## WorkLimiter::start_cycle ### Description Begins a new work cycle. Resets the count of completed work items and records the start time if the limiter is in measurement mode. ### Arguments * `now` (impl Fn() -> Instant) - A closure that returns the current instant for timing. ``` -------------------------------- ### Set Default Client Configuration Source: https://docs.rs/quinn/0.11.8/quinn/struct.Endpoint.html Sets the default client configuration that will be used by the `connect` method. ```rust pub fn set_default_client_config(&mut self, config: ClientConfig) ``` -------------------------------- ### MtuDiscoveryConfig Methods Source: https://docs.rs/quinn/0.11.8/quinn/struct.MtuDiscoveryConfig.html Provides information about the clone and clone_from methods available for MtuDiscoveryConfig. ```APIDOC ## fn clone(&self) -> MtuDiscoveryConfig ### Description Returns a duplicate of the value. ### Method clone ### Parameters None ### Response #### Success Response (MtuDiscoveryConfig) - Returns a new MtuDiscoveryConfig instance that is a copy of the original. ``` ```APIDOC ## fn clone_from(&mut self, source: &Self) ### Description Performs copy-assignment from `source`. ### Method clone_from ### Parameters - **source** (*Self*) - The source MtuDiscoveryConfig to copy from. ### Response None ``` -------------------------------- ### may_fragment Source: https://docs.rs/quinn/0.11.8/quinn/trait.AsyncUdpSocket.html Indicates whether datagrams might get fragmented into multiple parts. Sockets should prevent this for best performance. ```APIDOC ## fn may_fragment(&self) -> bool ### Description Whether datagrams might get fragmented into multiple parts Sockets should prevent this for best performance. See e.g. the `IPV6_DONTFRAG` socket option. ### Method `may_fragment` ``` -------------------------------- ### SmolRuntime Source: https://docs.rs/quinn/0.11.8/src/quinn/runtime/async_io.rs.html A Quinn runtime implementation for the `smol` asynchronous runtime. ```APIDOC ## SmolRuntime ### Description A Quinn runtime for smol. ### Struct `SmolRuntime` ### Methods - `new_timer(&self, t: Instant) -> Pin>`: Creates a new timer. - `spawn(&self, future: Pin + Send>>)`: Spawns a new asynchronous task. - `wrap_udp_socket(&self, sock: std::net::UdpSocket) -> io::Result>`: Wraps a UDP socket for asynchronous operations. ``` -------------------------------- ### Get Minimum of two StreamIds Source: https://docs.rs/quinn/0.11.8/quinn/struct.StreamId.html Returns the minimum of two StreamId values. This is part of the Ord trait implementation. ```rust fn min(self, other: Self) -> Self where Self: Sized, ``` -------------------------------- ### ServerConfig::with_crypto Source: https://docs.rs/quinn/0.11.8/quinn/struct.ServerConfig.html Creates a ServerConfig using an existing crypto::ServerConfig. It also uses a randomized handshake token key. ```APIDOC ## pub fn with_crypto(crypto: Arc) -> ServerConfig ### Description Create a server config with the given `crypto::ServerConfig` Uses a randomized handshake token key. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ### Request Example ```rust // Example usage (assuming crypto::ServerConfig is defined and available) // let crypto_config: Arc = ...; // let config = ServerConfig::with_crypto(crypto_config); ``` ### Response #### Success Response (ServerConfig) - `ServerConfig`: A new ServerConfig instance is created. #### Response Example ```rust // let crypto_config: Arc = ...; // let config = ServerConfig::with_crypto(crypto_config); // println!("ServerConfig created using crypto config."); ``` ``` -------------------------------- ### ControllerFactory::build Source: https://docs.rs/quinn/0.11.8/quinn/congestion/trait.ControllerFactory.html Constructs a fresh congestion controller. ```APIDOC ## fn build(self: Arc, now: Instant, current_mtu: u16) -> Box ### Description Construct a fresh `Controller`. ### Parameters #### Path Parameters - **self** (Arc) - Required - The controller factory instance. - **now** (Instant) - Required - The current time. - **current_mtu** (u16) - Required - The current Maximum Transmission Unit. ### Returns - Box - A new congestion controller. ``` -------------------------------- ### Get Maximum of two StreamIds Source: https://docs.rs/quinn/0.11.8/quinn/struct.StreamId.html Returns the maximum of two StreamId values. This is part of the Ord trait implementation. ```rust fn max(self, other: Self) -> Self where Self: Sized, ``` -------------------------------- ### Get StreamId Index Source: https://docs.rs/quinn/0.11.8/quinn/struct.StreamId.html Returns the index distinguishing streams of the same initiator and directionality. This ensures each stream has a unique identifier. ```rust pub fn index(self) -> u64 ``` -------------------------------- ### Create Initial Keys Source: https://docs.rs/quinn/0.11.8/quinn/crypto/trait.Session.html Generates the initial set of cryptographic keys for a connection, using the destination ConnectionId and the connection side (client/server). ```rust fn initial_keys(&self, dst_cid: &ConnectionId, side: Side) -> Keys; ``` -------------------------------- ### Get maximum UDP payload size Source: https://docs.rs/quinn/0.11.8/quinn/struct.EndpointConfig.html Retrieves the current maximum UDP payload size setting for the endpoint. ```rust pub fn get_max_udp_payload_size(&self) -> u64 ``` -------------------------------- ### Create ClientConfig trusting specified root certificates Source: https://docs.rs/quinn/0.11.8/quinn/struct.ClientConfig.html Builds a `ClientConfig` that explicitly trusts a provided set of root certificates. This is useful for custom trust anchors or environments without a standard platform verifier. Requires a `RootCertStore` and may return a `VerifierBuilderError`. ```rust pub fn with_root_certificates( roots: Arc, ) -> Result ``` -------------------------------- ### QuicClientConfig::try_from (ClientConfig) Source: https://docs.rs/quinn/0.11.8/quinn/crypto/rustls/struct.QuicClientConfig.html Attempts to convert a `ClientConfig` into a `QuicClientConfig`. This conversion requires the inner `rustls::ClientConfig` to have TLS 1.3 support enabled. ```APIDOC ## QuicClientConfig::try_from ### Description Performs the conversion from a `ClientConfig` to `QuicClientConfig`. This conversion requires the inner `rustls::ClientConfig` to have TLS 1.3 support enabled. ### Signature ```rust impl TryFrom for QuicClientConfig ``` ### Type Alias - `Error`: `NoInitialCipherSuite` ### Method ```rust fn try_from( inner: ClientConfig, ) -> Result>::Error> ``` ### Parameters - `inner`: A `ClientConfig` to convert. ### Returns A `Result` which is `Ok(QuicClientConfig)` on success, or `Err(NoInitialCipherSuite)` if the conversion fails. ``` -------------------------------- ### Get Source Error Source: https://docs.rs/quinn/0.11.8/quinn/enum.ReadExactError.html Retrieves the underlying error if `ReadExactError` was created from a `ReadError`. This is part of the `Error` trait implementation. ```rust fn source(&self) -> Option<&(dyn Error + 'static)> { // ... implementation details ... } ``` -------------------------------- ### CloneToUninit for ConnectionClose (Nightly) Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionClose.html Nightly-only experimental API for performing copy-assignment from ConnectionClose to uninitialized memory. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### Get Handshake Data Source: https://docs.rs/quinn/0.11.8/quinn/crypto/trait.Session.html Retrieves data negotiated during the cryptographic handshake. Returns `None` until the connection state is `HandshakeDataReady`. ```rust fn handshake_data(&self) -> Option>; ``` -------------------------------- ### Generic Implementations for NewReno Source: https://docs.rs/quinn/0.11.8/quinn/congestion/struct.NewReno.html Showcases various blanket implementations for NewReno, including Any, Borrow, CloneToUninit, From, Instrument, Into, ToOwned, TryFrom, TryInto, VZip, and WithSubscriber. ```rust fn type_id(&self) -> TypeId ``` ```rust fn borrow(&self) -> &T ``` ```rust fn borrow_mut(&mut self) -> &mut T ``` ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` ```rust fn from(t: T) -> T ``` ```rust fn instrument(self, span: Span) -> Instrumented ``` ```rust fn in_current_span(self) -> Instrumented ``` ```rust fn into(self) -> U ``` ```rust type Owned = T ``` ```rust fn to_owned(&self) -> T ``` ```rust fn clone_into(&self, target: &mut T) ``` ```rust type Error = Infallible ``` ```rust fn try_from(value: U) -> Result>::Error> ``` ```rust type Error = >::Error ``` ```rust fn try_into(self) -> Result>::Error> ``` ```rust fn vzip(self) -> V ``` ```rust fn with_subscriber(self, subscriber: S) -> WithDispatch ``` -------------------------------- ### rchunks_exact Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionId.html Returns an iterator over `chunk_size` elements of the slice at a time, starting at the end of the slice. The chunks are slices and do not overlap. ```APIDOC ## pub fn rchunks_exact(&self, chunk_size: usize) -> RChunksExact<'_, T> ### Description Returns an iterator over `chunk_size` elements of the slice at a time, starting at the end of the slice. The chunks are slices and do not overlap. If `chunk_size` does not divide the length of the slice, then the last up to `chunk_size-1` elements will be omitted and can be retrieved from the `remainder` function of the iterator. Due to each chunk having exactly `chunk_size` elements, the compiler can often optimize the resulting code better than in the case of `rchunks`. See `rchunks` for a variant of this iterator that also returns the remainder as a smaller chunk, and `chunks_exact` for the same iterator but starting at the beginning of the slice. If your `chunk_size` is a constant, consider using `as_rchunks` instead, which will give references to arrays of exactly that length, rather than slices. ### Panics Panics if `chunk_size` is zero. ### Examples ```rust let slice = ['l', 'o', 'r', 'e', 'm']; let mut iter = slice.rchunks_exact(2); assert_eq!(iter.next().unwrap(), &['e', 'm']); assert_eq!(iter.next().unwrap(), &['o', 'r']); assert!(iter.next().is_none()); assert_eq!(iter.remainder(), &['l']); ``` ``` -------------------------------- ### rchunks Source: https://docs.rs/quinn/0.11.8/quinn/struct.ConnectionId.html Returns an iterator over `chunk_size` elements of the slice at a time, starting at the end of the slice. The chunks are slices and do not overlap. ```APIDOC ## pub fn rchunks(&self, chunk_size: usize) -> RChunks<'_, T> ### Description Returns an iterator over `chunk_size` elements of the slice at a time, starting at the end of the slice. The chunks are slices and do not overlap. If `chunk_size` does not divide the length of the slice, then the last chunk will not have length `chunk_size`. See `rchunks_exact` for a variant of this iterator that returns chunks of always exactly `chunk_size` elements, and `chunks` for the same iterator but starting at the beginning of the slice. If your `chunk_size` is a constant, consider using `as_rchunks` instead, which will give references to arrays of exactly that length, rather than slices. ### Panics Panics if `chunk_size` is zero. ### Examples ```rust let slice = ['l', 'o', 'r', 'e', 'm']; let mut iter = slice.rchunks(2); assert_eq!(iter.next().unwrap(), &['e', 'm']); assert_eq!(iter.next().unwrap(), &['o', 'r']); assert_eq!(iter.next().unwrap(), &['l']); assert!(iter.next().is_none()); ``` ```