@@ -28,10 +28,10 @@ use crate::api;
2828use crate :: auth:: { Auth , AuthError } ;
2929
3030#[ derive( Debug , Clone ) ]
31- pub enum RootCertificate {
32- Der ( Vec < u8 > ) ,
33- Pem ( Vec < u8 > ) ,
34- PemBundle ( Vec < u8 > ) ,
31+ pub enum RootCertificate < ' a > {
32+ Der ( & ' a [ u8 ] ) ,
33+ Pem ( & ' a [ u8 ] ) ,
34+ PemBundle ( & ' a [ u8 ] ) ,
3535}
3636
3737#[ derive( Debug , Error ) ]
@@ -138,13 +138,13 @@ impl Debug for Gitlab {
138138/// Should a certificate be validated in TLS connections.
139139/// The Insecure option is used for self-signed certificates.
140140#[ derive( Debug , Clone ) ]
141- enum CertPolicy {
141+ enum CertPolicy < ' a > {
142142 Default ,
143143 /// Trust all certificates (including expired certificates). This introduces significant
144144 /// vulnerabilities, and should only be used as a last resort.
145145 Insecure ,
146146 /// Trust certificates signed by the root certificate.
147- SelfSigned ( RootCertificate ) ,
147+ SelfSigned ( RootCertificate < ' a > ) ,
148148}
149149
150150impl Gitlab {
@@ -314,13 +314,13 @@ impl Gitlab {
314314 let mut builder = Client :: builder ( ) ;
315315 match cert {
316316 RootCertificate :: Der ( der) => {
317- builder = builder. add_root_certificate ( Certificate :: from_der ( & der) ?) ;
317+ builder = builder. add_root_certificate ( Certificate :: from_der ( der) ?) ;
318318 } ,
319319 RootCertificate :: Pem ( pem) => {
320- builder = builder. add_root_certificate ( Certificate :: from_pem ( & pem) ?) ;
320+ builder = builder. add_root_certificate ( Certificate :: from_pem ( pem) ?) ;
321321 } ,
322322 RootCertificate :: PemBundle ( pem_bundle) => {
323- for certificate in Certificate :: from_pem_bundle ( & pem_bundle) ? {
323+ for certificate in Certificate :: from_pem_bundle ( pem_bundle) ? {
324324 builder = builder. add_root_certificate ( certificate) ;
325325 }
326326 } ,
@@ -344,7 +344,7 @@ impl Gitlab {
344344 }
345345
346346 /// Create a new Gitlab API client builder.
347- pub fn builder < H , T > ( host : H , token : T ) -> GitlabBuilder
347+ pub fn builder < ' a , H , T > ( host : H , token : T ) -> GitlabBuilder < ' a >
348348 where
349349 H : Into < String > ,
350350 T : Into < String > ,
@@ -458,15 +458,15 @@ impl api::Client for Gitlab {
458458 }
459459}
460460
461- pub struct GitlabBuilder {
461+ pub struct GitlabBuilder < ' a > {
462462 protocol : & ' static str ,
463463 host : String ,
464464 token : Auth ,
465- cert_validation : CertPolicy ,
465+ cert_validation : CertPolicy < ' a > ,
466466 identity : ClientCert ,
467467}
468468
469- impl GitlabBuilder {
469+ impl < ' a > GitlabBuilder < ' a > {
470470 /// Create a new Gitlab API client builder.
471471 pub fn new < H , T > ( host : H , token : T ) -> Self
472472 where
@@ -608,11 +608,11 @@ impl api::AsyncClient for AsyncGitlab {
608608
609609impl AsyncGitlab {
610610 /// Internal method to create a new Gitlab client.
611- async fn new_impl (
611+ async fn new_impl < ' a > (
612612 protocol : & str ,
613613 host : & str ,
614614 auth : Auth ,
615- cert_validation : CertPolicy ,
615+ cert_validation : CertPolicy < ' a > ,
616616 identity : ClientCert ,
617617 ) -> GitlabResult < Self > {
618618 let instance_url = Url :: parse ( & format ! ( "{}://{}/" , protocol, host) ) ?;
@@ -644,13 +644,13 @@ impl AsyncGitlab {
644644 let mut builder = AsyncClient :: builder ( ) ;
645645 match cert {
646646 RootCertificate :: Der ( der) => {
647- builder = builder. add_root_certificate ( Certificate :: from_der ( & der) ?) ;
647+ builder = builder. add_root_certificate ( Certificate :: from_der ( der) ?) ;
648648 } ,
649649 RootCertificate :: Pem ( pem) => {
650- builder = builder. add_root_certificate ( Certificate :: from_pem ( & pem) ?) ;
650+ builder = builder. add_root_certificate ( Certificate :: from_pem ( pem) ?) ;
651651 } ,
652652 RootCertificate :: PemBundle ( pem_bundle) => {
653- for certificate in Certificate :: from_pem_bundle ( & pem_bundle) ? {
653+ for certificate in Certificate :: from_pem_bundle ( pem_bundle) ? {
654654 builder = builder. add_root_certificate ( certificate) ;
655655 }
656656 } ,
0 commit comments