Skip to content

Commit a21d3ed

Browse files
committed
Merge #90: Do not require know size at compile time
060ef26 Do not require know size at compile time (Tobin C. Harding) Pull request description: The `Base32Len` and `ToBase32` traits currently require the implementing type to have a known size at compile time. This is an unnecessary restriction. Fix: #82 FTR I did not know at first which functions this reasoning could by applied to so I added `+ ?Sized` to every generic that was `AsRef<[u8]>` and let the compiler tell me which ones were correct. ACKs for top commit: apoelstra: ACK 060ef26 Tree-SHA512: ad03db3244203e7d3f74dda2ec46bdde5395e9bfc37e7ccf5a2886a16c4ad16710473b616a944699babc111f61fdca80cf2e9f5f448d219b335a5057ec5cec38
2 parents 27bfcba + 060ef26 commit a21d3ed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ pub trait Base32Len: ToBase32 {
309309
}
310310

311311
#[cfg(feature = "alloc")]
312-
impl<T: AsRef<[u8]>> ToBase32 for T {
312+
impl<T: AsRef<[u8]> + ?Sized> ToBase32 for T {
313313
fn write_base32<W: WriteBase32>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err> {
314314
// Amount of bits left over from last round, stored in buffer.
315315
let mut buffer_bits = 0u32;
@@ -354,7 +354,7 @@ impl<T: AsRef<[u8]>> ToBase32 for T {
354354
}
355355

356356
#[cfg(feature = "alloc")]
357-
impl<T: AsRef<[u8]>> Base32Len for T {
357+
impl<T: AsRef<[u8]> + ?Sized> Base32Len for T {
358358
fn base32_len(&self) -> usize {
359359
let bits = self.as_ref().len() * 8;
360360
if bits % 5 == 0 {

0 commit comments

Comments
 (0)