@@ -150,6 +150,7 @@ use crate::command::EndpointCommands;
150150use crate :: identity:: EndpointIdentity ;
151151use crate :: identity:: certificate_pid;
152152use crate :: io:: PacketIo ;
153+ use crate :: io:: PacketSendSlot ;
153154
154155mod connection;
155156mod network;
@@ -461,9 +462,9 @@ fn complete_unknown(submission: Submission, completions: &mut Vec<Completion>) {
461462}
462463
463464/// Single-owner quiche endpoint state machine.
464- pub struct Endpoint {
465+ pub struct Endpoint < I > {
465466 driver : DriverId ,
466- io : Box < dyn PacketIo > ,
467+ io : I ,
467468 network : Network ,
468469 submission_queue : EndpointSubmissionReceiver < EndpointCommand > ,
469470 completion_sender : CompletionSender ,
@@ -481,9 +482,9 @@ pub struct Endpoint {
481482 next_statistics_update : Instant ,
482483}
483484
484- impl Endpoint {
485+ impl < I : PacketIo > Endpoint < I > {
485486 /// Constructs a client endpoint and its thread-safe application handles.
486- pub fn client < I : PacketIo + ' static > (
487+ pub fn client (
487488 driver : DriverId ,
488489 io : I ,
489490 identity : EndpointIdentity ,
@@ -507,7 +508,7 @@ impl Endpoint {
507508 }
508509
509510 /// Constructs a client endpoint with explicit admission limits.
510- pub fn client_with_limits < I : PacketIo + ' static > (
511+ pub fn client_with_limits (
511512 driver : DriverId ,
512513 io : I ,
513514 identity : EndpointIdentity ,
@@ -532,7 +533,7 @@ impl Endpoint {
532533 }
533534
534535 /// Constructs a server endpoint and its thread-safe application handles.
535- pub fn server < I : PacketIo + ' static > (
536+ pub fn server (
536537 driver : DriverId ,
537538 io : I ,
538539 identity : EndpointIdentity ,
@@ -556,7 +557,7 @@ impl Endpoint {
556557 }
557558
558559 /// Constructs a server endpoint with explicit admission limits.
559- pub fn server_with_limits < I : PacketIo + ' static > (
560+ pub fn server_with_limits (
560561 driver : DriverId ,
561562 io : I ,
562563 identity : EndpointIdentity ,
@@ -581,7 +582,7 @@ impl Endpoint {
581582 }
582583
583584 /// Constructs a duplex endpoint that can initiate and accept connections.
584- pub fn duplex < I : PacketIo + ' static > (
585+ pub fn duplex (
585586 driver : DriverId ,
586587 io : I ,
587588 identity : EndpointIdentity ,
@@ -606,7 +607,7 @@ impl Endpoint {
606607 }
607608
608609 /// Constructs a duplex endpoint with explicit admission limits.
609- pub fn duplex_with_limits < I : PacketIo + ' static > (
610+ pub fn duplex_with_limits (
610611 driver : DriverId ,
611612 io : I ,
612613 identity : EndpointIdentity ,
@@ -633,7 +634,7 @@ impl Endpoint {
633634 }
634635
635636 /// Constructs a duplex endpoint whose CIDs use `routing_pid` independently of its identity.
636- pub fn duplex_routed < I : PacketIo + ' static > (
637+ pub fn duplex_routed (
637638 driver : DriverId ,
638639 io : I ,
639640 identity : EndpointIdentity ,
@@ -659,7 +660,7 @@ impl Endpoint {
659660 }
660661
661662 /// Constructs a routed duplex endpoint with explicit admission limits.
662- pub fn duplex_routed_with_limits < I : PacketIo + ' static > (
663+ pub fn duplex_routed_with_limits (
663664 driver : DriverId ,
664665 io : I ,
665666 identity : EndpointIdentity ,
@@ -684,7 +685,7 @@ impl Endpoint {
684685 )
685686 }
686687
687- fn new < I : PacketIo + ' static > (
688+ fn new (
688689 driver : DriverId ,
689690 io : I ,
690691 _identity : EndpointIdentity ,
@@ -717,7 +718,7 @@ impl Endpoint {
717718 (
718719 Self {
719720 driver,
720- io : Box :: new ( io ) ,
721+ io,
721722 network : Network :: new (
722723 driver,
723724 routing_pid,
@@ -836,7 +837,7 @@ impl Endpoint {
836837 }
837838 self . flush_completions ( ) ;
838839 self . network
839- . queue_packets ( self . io . as_mut ( ) , & mut self . new_completions ) ?;
840+ . queue_packets ( & mut self . io , & mut self . new_completions ) ?;
840841
841842 let mut wait = self . network . next_timeout ( maximum_wait) ;
842843 if let Some ( deadline) = self . shutdown_deadline {
@@ -850,7 +851,7 @@ impl Endpoint {
850851 self . update_statistics ( ) ;
851852 self . expire_shutdown ( ) ;
852853 self . network
853- . queue_packets ( self . io . as_mut ( ) , & mut self . new_completions ) ?;
854+ . queue_packets ( & mut self . io , & mut self . new_completions ) ?;
854855 self . stage_completions ( ) ;
855856 self . flush_completions ( ) ;
856857 self . finish_shutdown_if_ready ( ) ;
0 commit comments