File tree Expand file tree Collapse file tree 7 files changed +11
-15
lines changed
Expand file tree Collapse file tree 7 files changed +11
-15
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " udp-request"
3- version = " 0.3.4 "
3+ version = " 0.3.5 "
44readme = " README.md"
55edition = " 2024"
66authors = [" root@ltpp.vip" ]
Original file line number Diff line number Diff line change 11pub ( crate ) mod config;
22pub ( crate ) mod error;
3- pub ( crate ) mod request;
43pub ( crate ) mod request_builder;
54pub ( crate ) mod r#trait;
65pub ( crate ) mod r#type;
6+ pub ( crate ) mod udp_request;
77
88pub use error:: r#enum:: * ;
99pub use request_builder:: r#struct:: * ;
1010pub use r#trait:: * ;
1111pub use r#type:: * ;
1212
1313pub ( crate ) use config:: r#struct:: * ;
14- pub ( crate ) use request :: r#struct:: * ;
14+ pub ( crate ) use udp_request :: r#struct:: * ;
Original file line number Diff line number Diff line change @@ -39,9 +39,8 @@ impl RequestBuilder {
3939 where
4040 T : Into < String > ,
4141 {
42- let _ = self . udp_request . config . write ( ) . and_then ( |mut data| {
42+ let _ = self . udp_request . config . write ( ) . map ( |mut data| {
4343 data. host = host. into ( ) ;
44- Ok ( ( ) )
4544 } ) ;
4645 self
4746 }
@@ -56,9 +55,8 @@ impl RequestBuilder {
5655 ///
5756 /// - `&mut Self` - A mutable reference to the `RequestBuilder` for method chaining.
5857 pub fn port ( & mut self , port : usize ) -> & mut Self {
59- let _ = self . udp_request . config . write ( ) . and_then ( |mut data| {
58+ let _ = self . udp_request . config . write ( ) . map ( |mut data| {
6059 data. port = port;
61- Ok ( ( ) )
6260 } ) ;
6361 self
6462 }
@@ -73,9 +71,8 @@ impl RequestBuilder {
7371 ///
7472 /// - `&mut Self` - A mutable reference to the `RequestBuilder` for method chaining.
7573 pub fn buffer ( & mut self , buffer_size : usize ) -> & mut Self {
76- let _ = self . udp_request . config . write ( ) . and_then ( |mut data| {
74+ let _ = self . udp_request . config . write ( ) . map ( |mut data| {
7775 data. buffer_size = buffer_size;
78- Ok ( ( ) )
7976 } ) ;
8077 self
8178 }
@@ -90,9 +87,8 @@ impl RequestBuilder {
9087 ///
9188 /// - `&mut Self` - A mutable reference to the `RequestBuilder` for method chaining.
9289 pub fn timeout ( & mut self , timeout : u64 ) -> & mut Self {
93- let _ = self . udp_request . config . write ( ) . and_then ( |mut data| {
90+ let _ = self . udp_request . config . write ( ) . map ( |mut data| {
9491 data. timeout = timeout;
95- Ok ( ( ) )
9692 } ) ;
9793 self
9894 }
Original file line number Diff line number Diff line change @@ -60,9 +60,9 @@ impl UdpRequest {
6060 self . response = Arc :: new ( RwLock :: new ( <UdpResponseBinary as ResponseTrait >:: from (
6161 & response_bytes,
6262 ) ) ) ;
63- return Ok ( Box :: new (
63+ Ok ( Box :: new (
6464 self . response . read ( ) . map_or ( Vec :: new ( ) , |data| data. clone ( ) ) ,
65- ) ) ;
65+ ) )
6666 }
6767
6868 /// Creates and configures a UDP socket for the connection.
@@ -117,7 +117,7 @@ impl RequestTrait for UdpRequest {
117117 . read ( )
118118 . map_or ( Config :: default ( ) , |data| data. clone ( ) ) ;
119119 let host: String = cfg_timeout. host . clone ( ) ;
120- let port: usize = cfg_timeout. port . clone ( ) ;
120+ let port: usize = cfg_timeout. port ;
121121 let mut socket: UdpSocket = self . get_connection_socket ( host, port) ?;
122122 let res: Result < BoxResponseTrait , RequestError > = self . send_request ( & mut socket, data) ;
123123 res
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ impl ResponseTrait for UdpResponseBinary {
3939 /// - `UdpResponseText` - The text representation of the response, with invalid UTF-8 sequences replaced.
4040 #[ inline]
4141 fn text ( & self ) -> UdpResponseText {
42- let data: String = String :: from_utf8_lossy ( & self ) . to_string ( ) ;
42+ let data: String = String :: from_utf8_lossy ( self ) . to_string ( ) ;
4343 data
4444 }
4545}
You can’t perform that action at this time.
0 commit comments