From 841395baf0d89113428ad3dd4186883a7c1d8b50 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sun, 3 Nov 2024 09:38:49 -0500 Subject: [PATCH] Remove type-bounds that aren't needed. (#495) It's fine to parametrize a SequenceOf with something that isn't an Asn1 type, because for SequenceOf to be an Asn1 type, T must implement the trait. In practice this is useful with certain GAT patterns. --- src/types.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/types.rs b/src/types.rs index 55edcb3..15c3ade 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1271,7 +1271,7 @@ impl SimpleAsn1Writable for SequenceWriter<'_> { /// are decoded. pub struct SequenceOf< 'a, - T: Asn1Readable<'a>, + T, const MINIMUM_LEN: usize = 0, const MAXIMUM_LEN: usize = { usize::MAX }, > { @@ -1414,7 +1414,7 @@ impl< /// Writes a `SEQUENCE OF` ASN.1 structure from a slice of `T`. #[derive(Hash, PartialEq, Eq, Clone)] -pub struct SequenceOfWriter<'a, T: Asn1Writable, V: Borrow<[T]> = &'a [T]> { +pub struct SequenceOfWriter<'a, T, V: Borrow<[T]> = &'a [T]> { vals: V, _phantom: PhantomData<&'a T>, } @@ -1442,7 +1442,7 @@ impl> SimpleAsn1Writable for SequenceOfWriter<'_ /// Represents an ASN.1 `SET OF`. This is an `Iterator` over values that /// are decoded. -pub struct SetOf<'a, T: Asn1Readable<'a>> { +pub struct SetOf<'a, T> { parser: Parser<'a>, _phantom: PhantomData, } @@ -1555,7 +1555,7 @@ impl<'a, T: Asn1Readable<'a> + Asn1Writable> SimpleAsn1Writable for SetOf<'a, T> /// Writes an ASN.1 `SET OF` whose contents is a slice of `T`. This type handles /// ensuring that the values are properly ordered when written as DER. #[derive(Hash, PartialEq, Eq, Clone)] -pub struct SetOfWriter<'a, T: Asn1Writable, V: Borrow<[T]> = &'a [T]> { +pub struct SetOfWriter<'a, T, V: Borrow<[T]> = &'a [T]> { vals: V, _phantom: PhantomData<&'a T>, }