@@ -110,7 +110,10 @@ impl Socket {
110110 } )
111111 . await
112112 }
113+ }
113114
115+ #[ async_trait]
116+ impl ObjectInterface for Socket {
114117 async fn poll ( & self , event : PollEvent ) -> io:: Result < PollEvent > {
115118 future:: poll_fn ( |cx| {
116119 self . with ( |socket| match socket. state ( ) {
@@ -475,64 +478,3 @@ impl Drop for Socket {
475478 }
476479 }
477480}
478-
479- #[ async_trait]
480- impl ObjectInterface for Socket {
481- async fn poll ( & self , event : PollEvent ) -> io:: Result < PollEvent > {
482- self . poll ( event) . await
483- }
484-
485- async fn read ( & self , buffer : & mut [ u8 ] ) -> io:: Result < usize > {
486- self . read ( buffer) . await
487- }
488-
489- async fn write ( & self , buffer : & [ u8 ] ) -> io:: Result < usize > {
490- self . write ( buffer) . await
491- }
492-
493- async fn bind ( & mut self , endpoint : ListenEndpoint ) -> io:: Result < ( ) > {
494- self . bind ( endpoint) . await
495- }
496-
497- async fn connect ( & mut self , endpoint : Endpoint ) -> io:: Result < ( ) > {
498- self . connect ( endpoint) . await
499- }
500-
501- async fn accept (
502- & mut self ,
503- ) -> io:: Result < ( Arc < async_lock:: RwLock < dyn ObjectInterface > > , Endpoint ) > {
504- self . accept ( ) . await
505- }
506-
507- async fn getpeername ( & self ) -> io:: Result < Option < Endpoint > > {
508- self . getpeername ( ) . await
509- }
510-
511- async fn getsockname ( & self ) -> io:: Result < Option < Endpoint > > {
512- self . getsockname ( ) . await
513- }
514-
515- async fn listen ( & mut self , backlog : i32 ) -> io:: Result < ( ) > {
516- self . listen ( backlog) . await
517- }
518-
519- async fn setsockopt ( & self , opt : SocketOption , optval : bool ) -> io:: Result < ( ) > {
520- self . setsockopt ( opt, optval) . await
521- }
522-
523- async fn getsockopt ( & self , opt : SocketOption ) -> io:: Result < bool > {
524- self . getsockopt ( opt) . await
525- }
526-
527- async fn shutdown ( & self , how : i32 ) -> io:: Result < ( ) > {
528- self . shutdown ( how) . await
529- }
530-
531- async fn status_flags ( & self ) -> io:: Result < fd:: StatusFlags > {
532- self . status_flags ( ) . await
533- }
534-
535- async fn set_status_flags ( & mut self , status_flags : fd:: StatusFlags ) -> io:: Result < ( ) > {
536- self . set_status_flags ( status_flags) . await
537- }
538- }
0 commit comments