@@ -33,6 +33,7 @@ println!("{}", key_pair.serialize_pem());
3333#![ cfg_attr( docsrs, feature( doc_cfg, doc_auto_cfg) ) ]
3434#![ warn( unreachable_pub) ]
3535
36+ use std:: collections:: VecDeque ;
3637use std:: fmt;
3738use std:: hash:: Hash ;
3839use std:: net:: IpAddr ;
@@ -298,7 +299,7 @@ See also the RFC 5280 sections on the [issuer](https://tools.ietf.org/html/rfc52
298299and [subject](https://tools.ietf.org/html/rfc5280#section-4.1.2.6) fields.
299300*/
300301pub struct DistinguishedName {
301- entries : Vec < ( DnType , DnValue ) > ,
302+ entries : VecDeque < ( DnType , DnValue ) > ,
302303}
303304
304305impl DistinguishedName {
@@ -345,7 +346,7 @@ impl DistinguishedName {
345346 /// assert_eq!(dn.get(&DnType::CommonName).get(0), Some(&DnValue::PrintableString("Master Cert".try_into().unwrap())).as_ref());
346347 /// ```
347348 pub fn push ( & mut self , ty : DnType , s : impl Into < DnValue > ) {
348- self . entries . push ( ( ty, s. into ( ) ) ) ;
349+ self . entries . push_front ( ( ty, s. into ( ) ) ) ;
349350 }
350351
351352 #[ cfg( feature = "x509-parser" ) ]
@@ -397,7 +398,7 @@ impl Iterator for DistinguishedName {
397398 type Item = ( DnType , DnValue ) ;
398399
399400 fn next ( & mut self ) -> Option < Self :: Item > {
400- self . entries . pop ( )
401+ self . entries . pop_back ( )
401402 }
402403
403404 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
0 commit comments