@@ -585,18 +585,40 @@ impl IntoFuture for IncomingSession {
585585pub struct IncomingSessionFuture ( Pin < Box < DynFutureIncomingSession > > ) ;
586586
587587impl IncomingSessionFuture {
588- fn new ( quic_incoming : quinn:: Incoming ) -> Self {
589- Self ( Box :: pin ( Self :: accept ( quic_incoming) ) )
588+ /// Creates a future from [`quinn::Incoming`].
589+ ///
590+ /// The returned future resolves to a [`SessionRequest`] once the QUIC connection
591+ /// is established and the WebTransport session has been accepted.
592+ #[ cfg( feature = "quinn" ) ]
593+ #[ cfg_attr( docsrs, doc( cfg( feature = "quinn" ) ) ) ]
594+ pub fn with_quic_incoming ( quic_incoming : quinn:: Incoming ) -> Self {
595+ Self :: new ( quic_incoming)
596+ }
597+
598+ /// Creates a future from [`quinn::Connecting`].
599+ ///
600+ /// This is useful when a [`quinn::Connecting`] is already available and needs to be
601+ /// driven to completion to accept an incoming WebTransport session.
602+ ///
603+ /// The returned future resolves to a [`SessionRequest`] once the QUIC connection
604+ /// is established and the WebTransport session has been accepted.
605+ #[ cfg( feature = "quinn" ) ]
606+ #[ cfg_attr( docsrs, doc( cfg( feature = "quinn" ) ) ) ]
607+ pub fn with_quic_connecting ( quic_connecting : quinn:: Connecting ) -> Self {
608+ Self ( Box :: pin ( async move {
609+ let quic_connection = quic_connecting. await ?;
610+ Self :: accept ( quic_connection) . await
611+ } ) )
590612 }
591613
592- async fn accept ( quic_incoming : quinn:: Incoming ) -> Result < SessionRequest , ConnectionError > {
593- let quic_connection = quic_incoming. await ?;
594- Self :: accept_from_connection ( quic_connection) . await
614+ fn new ( quic_incoming : quinn:: Incoming ) -> Self {
615+ Self ( Box :: pin ( async move {
616+ let quic_connection = quic_incoming. await ?;
617+ Self :: accept ( quic_connection) . await
618+ } ) )
595619 }
596620
597- pub async fn accept_from_connection (
598- quic_connection : quinn:: Connection ,
599- ) -> Result < SessionRequest , ConnectionError > {
621+ async fn accept ( quic_connection : quinn:: Connection ) -> Result < SessionRequest , ConnectionError > {
600622 let driver = Driver :: init ( quic_connection. clone ( ) ) ;
601623
602624 let _settings = driver. accept_settings ( ) . await . map_err ( |driver_error| {
0 commit comments