Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
0x676e67 committed Jan 25, 2025
1 parent ea765a3 commit c14df16
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/tls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,18 +451,35 @@ macro_rules! impl_into_cert_compression_algorithm_for_arrays {

impl_into_cert_compression_algorithm_for_types!(
&'static [CertCompressionAlgorithm] => |s| Some(Cow::Borrowed(s)),
Option<&'static [CertCompressionAlgorithm]> => |s: Option<&'static [CertCompressionAlgorithm]>| s.map(Cow::Borrowed),
Option<&'static [CertCompressionAlgorithm]> => |s: Option<&'static [CertCompressionAlgorithm]>| s.map(Cow::Borrowed)
);

impl_into_cert_compression_algorithm_for_types!(
Cow<'static, [CertCompressionAlgorithm]> => |s| Some(s),
Option<Cow<'static, [CertCompressionAlgorithm]>> => |s| s,
Option<Cow<'static, [CertCompressionAlgorithm]>> => |s| s
);

impl_into_cert_compression_algorithm_for_types!(
&'static CertCompressionAlgorithm => |s: &'static CertCompressionAlgorithm| Some(Cow::Owned(vec![*s])),
Option<&'static CertCompressionAlgorithm> => |s: Option<&'static CertCompressionAlgorithm>| s.map(|alg| Cow::Owned(vec![*alg]))
);

impl_into_cert_compression_algorithm_for_types!(
CertCompressionAlgorithm => |s| Some(Cow::Owned(vec![s])),
Option<CertCompressionAlgorithm> => |s: Option<CertCompressionAlgorithm>| s.map(|alg| Cow::Owned(vec![alg])),
Option<CertCompressionAlgorithm> => |s: Option<CertCompressionAlgorithm>| s.map(|alg| Cow::Owned(vec![alg]))
);

impl_into_cert_compression_algorithm_for_types!(
Vec<CertCompressionAlgorithm> => |s| Some(Cow::Owned(s)),
Option<Vec<CertCompressionAlgorithm>> => |s: Option<Vec<CertCompressionAlgorithm>>| s.map(Cow::Owned)
);

impl_into_cert_compression_algorithm_for_arrays!(
&'static [CertCompressionAlgorithm; N] => |s: &'static [CertCompressionAlgorithm; N]| Some(Cow::Borrowed(&s[..])),
Option<&'static [CertCompressionAlgorithm; N]> => |s: Option<&'static [CertCompressionAlgorithm; N]>| s.map(|s| Cow::Borrowed(&s[..])),
Option<&'static [CertCompressionAlgorithm; N]> => |s: Option<&'static [CertCompressionAlgorithm; N]>| s.map(|s| Cow::Borrowed(&s[..]))
);

impl_into_cert_compression_algorithm_for_arrays!(
[CertCompressionAlgorithm; N] => |s: [CertCompressionAlgorithm; N]| Some(Cow::Owned(s.to_vec())),
Option<[CertCompressionAlgorithm; N]> => |s: Option<[CertCompressionAlgorithm; N]>| s.map(|arr| Cow::Owned(arr.to_vec()))
);

0 comments on commit c14df16

Please sign in to comment.