@@ -63,7 +63,7 @@ struct Inner<F, T> {
6363
6464impl WsClient < Base , ( ) > {
6565 /// Create new websocket client builder
66- pub fn build < U > ( uri : U ) -> WsClientBuilder < Base , Connector < Uri > >
66+ pub fn builder < U > ( uri : U ) -> WsClientBuilder < Base , Connector < Uri > >
6767 where
6868 Uri : TryFrom < U > ,
6969 <Uri as TryFrom < U > >:: Error : Into < HttpError > ,
@@ -541,7 +541,7 @@ where
541541 }
542542
543543 /// Complete building process and construct websockets client.
544- pub async fn finish < U : Into < SharedCfg > > (
544+ pub async fn build < U : Into < SharedCfg > > (
545545 & mut self ,
546546 cfg : U ,
547547 ) -> Result < WsClient < F , T :: Service > , WsClientBuilderError < T :: InitError > > {
@@ -787,25 +787,25 @@ mod tests {
787787
788788 #[ crate :: rt_test]
789789 async fn test_debug ( ) {
790- let mut builder = WsClient :: build ( "http://localhost" )
790+ let mut builder = WsClient :: builder ( "http://localhost" )
791791 . header ( "x-test" , "111" )
792792 . take ( ) ;
793793 let repr = format ! ( "{builder:?}" ) ;
794794 assert ! ( repr. contains( "WsClientBuilder" ) ) ;
795795 assert ! ( repr. contains( "x-test" ) ) ;
796796
797- let client = builder. finish ( SharedCfg :: default ( ) ) . await . unwrap ( ) ;
797+ let client = builder. build ( SharedCfg :: default ( ) ) . await . unwrap ( ) ;
798798 let repr = format ! ( "{client:?}" ) ;
799799 assert ! ( repr. contains( "WsClient" ) ) ;
800800 assert ! ( repr. contains( "x-test" ) ) ;
801801 }
802802
803803 #[ crate :: rt_test]
804804 async fn header_override ( ) {
805- let req = WsClient :: build ( "http://localhost" )
805+ let req = WsClient :: builder ( "http://localhost" )
806806 . header ( header:: CONTENT_TYPE , "111" )
807807 . set_header ( header:: CONTENT_TYPE , "222" )
808- . finish ( SharedCfg :: default ( ) )
808+ . build ( SharedCfg :: default ( ) )
809809 . await
810810 . unwrap ( ) ;
811811
@@ -822,20 +822,20 @@ mod tests {
822822
823823 #[ crate :: rt_test]
824824 async fn basic_errs ( ) {
825- let err = WsClient :: build ( "localhost" )
826- . finish ( SharedCfg :: default ( ) )
825+ let err = WsClient :: builder ( "localhost" )
826+ . build ( SharedCfg :: default ( ) )
827827 . await
828828 . err ( )
829829 . unwrap ( ) ;
830830 assert ! ( matches!( err, WsClientBuilderError :: MissingScheme ) ) ;
831- let err = WsClient :: build ( "unknown://localhost" )
832- . finish ( SharedCfg :: default ( ) )
831+ let err = WsClient :: builder ( "unknown://localhost" )
832+ . build ( SharedCfg :: default ( ) )
833833 . await
834834 . err ( )
835835 . unwrap ( ) ;
836836 assert ! ( matches!( err, WsClientBuilderError :: UnknownScheme ) ) ;
837- let err = WsClient :: build ( "/" )
838- . finish ( SharedCfg :: default ( ) )
837+ let err = WsClient :: builder ( "/" )
838+ . build ( SharedCfg :: default ( ) )
839839 . await
840840 . err ( )
841841 . unwrap ( ) ;
@@ -844,9 +844,9 @@ mod tests {
844844
845845 #[ crate :: rt_test]
846846 async fn basic_auth ( ) {
847- let client = WsClient :: build ( "http://localhost" )
847+ let client = WsClient :: builder ( "http://localhost" )
848848 . basic_auth ( "username" , Some ( "password" ) )
849- . finish ( SharedCfg :: default ( ) )
849+ . build ( SharedCfg :: default ( ) )
850850 . await
851851 . unwrap ( ) ;
852852 assert_eq ! (
@@ -860,9 +860,9 @@ mod tests {
860860 "Basic dXNlcm5hbWU6cGFzc3dvcmQ="
861861 ) ;
862862
863- let client = WsClient :: build ( "http://localhost" )
863+ let client = WsClient :: builder ( "http://localhost" )
864864 . basic_auth ( "username" , None )
865- . finish ( SharedCfg :: default ( ) )
865+ . build ( SharedCfg :: default ( ) )
866866 . await
867867 . unwrap ( ) ;
868868 assert_eq ! (
@@ -894,9 +894,9 @@ mod tests {
894894 #[ crate :: rt_test]
895895 #[ allow( clippy:: let_underscore_future) ]
896896 async fn bearer_auth ( ) {
897- let client = WsClient :: build ( "http://localhost" )
897+ let client = WsClient :: builder ( "http://localhost" )
898898 . bearer_auth ( "someS3cr3tAutht0k3n" )
899- . finish ( SharedCfg :: default ( ) )
899+ . build ( SharedCfg :: default ( ) )
900900 . await
901901 . unwrap ( ) ;
902902 assert_eq ! (
@@ -930,7 +930,7 @@ mod tests {
930930 #[ cfg( feature = "cookie" ) ]
931931 #[ crate :: rt_test]
932932 async fn basics ( ) {
933- let mut builder = WsClient :: build ( "http://localhost/" )
933+ let mut builder = WsClient :: builder ( "http://localhost/" )
934934 . origin ( "test-origin" )
935935 . max_frame_size ( 100 )
936936 . server_mode ( )
@@ -947,7 +947,7 @@ mod tests {
947947 assert ! ( builder. inner. as_ref( ) . unwrap( ) . server_mode) ;
948948 assert_eq ! ( builder. protocols, Some ( "v1,v2" . to_string( ) ) ) ;
949949
950- let client = builder. finish ( SharedCfg :: default ( ) ) . await . unwrap ( ) ;
950+ let client = builder. build ( SharedCfg :: default ( ) ) . await . unwrap ( ) ;
951951 assert_eq ! (
952952 client. head. headers. get( header:: CONTENT_TYPE ) . unwrap( ) ,
953953 header:: HeaderValue :: from_static( "json" )
@@ -956,20 +956,20 @@ mod tests {
956956 let _ = client. connect ( ) . await ;
957957
958958 assert ! (
959- WsClient :: build ( "/" )
960- . finish ( SharedCfg :: default ( ) )
959+ WsClient :: builder ( "/" )
960+ . build ( SharedCfg :: default ( ) )
961961 . await
962962 . is_err( )
963963 ) ;
964964 assert ! (
965- WsClient :: build ( "http:///test" )
966- . finish ( SharedCfg :: default ( ) )
965+ WsClient :: builder ( "http:///test" )
966+ . build ( SharedCfg :: default ( ) )
967967 . await
968968 . is_err( )
969969 ) ;
970970 assert ! (
971- WsClient :: build ( "hmm://test.com/" )
972- . finish ( SharedCfg :: default ( ) )
971+ WsClient :: builder ( "hmm://test.com/" )
972+ . build ( SharedCfg :: default ( ) )
973973 . await
974974 . is_err( )
975975 ) ;
0 commit comments