Closed zier-one closed 2 months ago
Thanks a lot for the issue! This is working as intended and probably a misunderstanding of the documentation. The documentation of decode_len
points to decode_mut
which explains that this is only a maximum. I'm improving the documentation in #112.
Here's an example of why decode_len
can't possibly return the exact length. Both inputs AA==
and AAA=
have a length of 4 bytes. However, the first decodes to 1 byte while the second decodes to 2 bytes. How can decode_len
return 2 different values by taking only the number 4 as input. It can only possibly return the smallest number greater or equal to all possible return value if the actual input was known (the definition of the maximum).
OK, thank for your attention and answers.
Steps to reproduce: Just run the code:
You can run this code on https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=8bb5438031e22614f781f65f11fdeb27
decode_len return a wrong result, the right one should be 32.