#[derive(Default, Debug, Clone, PartialEq, Eq)]
pub struct ApplicationLayerProtocolNegotiationProtocols(pub IndexSet<ApplicationLayerProtocolNegotiationProtocol>);
impl Deref for ApplicationLayerProtocolNegotiationProtocols
{
type Target = IndexSet<ApplicationLayerProtocolNegotiationProtocol>;
#[inline(always)]
fn deref(&self) -> &Self::Target
{
&self.0
}
}
impl DerefMut for ApplicationLayerProtocolNegotiationProtocols
{
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target
{
&mut self.0
}
}
impl ApplicationLayerProtocolNegotiationProtocols
{
#[inline(always)]
pub fn to_rustls_form(&self) -> Vec<Vec<u8>>
{
let mut protocols = Vec::with_capacity(self.0.len());
for application_layer_protocol_negotiation_protocol in self.0.iter()
{
assert_ne!(application_layer_protocol_negotiation_protocol, &ApplicationLayerProtocolNegotiationProtocol::HTTP_2_over_TCP, "HTTP_2_over_TCP can not be used with TLS");
protocols.push(application_layer_protocol_negotiation_protocol.to_vec())
}
protocols
}
}