Nullus157 / bs58-rs

Another Rust Base58 codec implementation
Apache License 2.0
76 stars 24 forks source link

Add with_check_version to EncodeBuilder #47

Closed fanatid closed 4 years ago

fanatid commented 4 years ago

Another proposal: add version to EncodeBuilder.

But last hour I fight with Iterator for encode_into:

error[E0277]: the trait bound `<I as core::iter::IntoIterator>::IntoIter: core::clone::Clone` is not satisfied
   --> src/encode.rs:368:17
    |
307 | fn encode_into<'a, I>(input: I, output: &mut [u8], alpha: &[u8; 58]) -> Result<usize>
    |    -----------
308 | where
309 |     I: Clone + IntoIterator<Item = &'a u8>,
    |        ----- required by this bound in `encode::encode_into`
...
368 |     encode_into(version.into_iter().chain(input.iter()).chain(checksum.iter()), output, alpha)
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |                 |
    |                 expected an implementor of trait `core::clone::Clone`
    |                 help: consider borrowing here: `&version.into_iter().chain(input.iter()).chain(checksum.iter())`
    |
    = note: required because of the requirements on the impl of `core::clone::Clone` for `core::iter::Chain<<I as core::iter::IntoIterator>::IntoIter, core::slice::Iter<'_, u8>>`
    = note: required because of the requirements on the impl of `core::clone::Clone` for `core::iter::Chain<core::iter::Chain<<I as core::iter::IntoIterator>::IntoIter, core::slice::Iter<'_, u8>>, core::slice::Iter<'_, u8>>`

@Nemo157 any ideas?

fanatid commented 4 years ago

Updated.

Nemo157 commented 4 years ago

Great, thanks again!

bors r+

bors[bot] commented 4 years ago

Build succeeded: