@@ -36,7 +36,7 @@ use bytes::{BufMut, Bytes, BytesMut};
3636
3737/// A TLS protocol version.
3838#[ derive( Debug , Clone , Copy , Hash , PartialEq , Eq ) ]
39- pub struct TlsVersion ( pub ( super ) ssl:: SslVersion ) ;
39+ pub struct TlsVersion ( ssl:: SslVersion ) ;
4040
4141impl TlsVersion {
4242 /// Version 1.0 of the TLS protocol.
@@ -66,13 +66,18 @@ impl AlpnProtocol {
6666 /// Prefer HTTP/3
6767 pub const HTTP3 : AlpnProtocol = AlpnProtocol ( b"h3" ) ;
6868
69+ /// Create a new [`AlpnProtocol`] from a static byte slice.
6970 #[ inline]
70- pub ( crate ) fn encode ( self ) -> Bytes {
71- Self :: encode_sequence ( std :: iter :: once ( & self ) )
71+ pub const fn new ( value : & ' static [ u8 ] ) -> Self {
72+ AlpnProtocol ( value )
7273 }
7374
7475 #[ inline]
75- pub ( crate ) fn encode_sequence < ' a , I > ( items : I ) -> Bytes
76+ fn encode ( self ) -> Bytes {
77+ Self :: encode_sequence ( std:: iter:: once ( & self ) )
78+ }
79+
80+ fn encode_sequence < ' a , I > ( items : I ) -> Bytes
7681 where
7782 I : IntoIterator < Item = & ' a AlpnProtocol > ,
7883 {
@@ -98,11 +103,6 @@ impl AlpsProtocol {
98103
99104 /// Prefer HTTP/3
100105 pub const HTTP3 : AlpsProtocol = AlpsProtocol ( b"h3" ) ;
101-
102- #[ inline]
103- pub ( crate ) const fn value ( self ) -> & ' static [ u8 ] {
104- self . 0
105- }
106106}
107107
108108#[ cfg( test) ]
0 commit comments