diff options
author | Teddy Wing | 2018-11-10 15:07:17 +0100 |
---|---|---|
committer | Teddy Wing | 2018-11-10 15:07:17 +0100 |
commit | e594577e14812ff4a7ca26dd2ffb506efc469b68 (patch) | |
tree | 5f1f55a5e60b8cb23553609676c6fb5b946acdda /license-generator/src/errors.rs | |
parent | 8edf2808e1b2f11ecb5e395452886e98ce8acb18 (diff) | |
download | dome-key-web-e594577e14812ff4a7ca26dd2ffb506efc469b68.tar.bz2 |
paddle: Take any kind of `str` reference input, not just `&str`
Use `AsRef<str>` instead of `&str` to offer a more flexible interface.
We need this because `url::form_urlencoded::parse()` gives us an
iterator of `(Cow<_, str>, Cow<_, str>)`, and we want to pass that into
`verify_signature()`.
Also change `key.len()` and `value.len()` to `.chars().count()` because
I was having a hard time getting the `len()` method from a trait (`str`
doesn't implement `ExactSizeIterator`), and I learned this:
> This length is in bytes, not chars or graphemes. In other words, it
> may not be what a human considers the length of the string.
(https://doc.rust-lang.org/std/primitive.str.html#method.len)
Also:
https://stackoverflow.com/questions/46290655/get-the-string-length-in-characters-in-rust/46290728#46290728
I assume the PHP serializer uses character count instead of byte length.
Diffstat (limited to 'license-generator/src/errors.rs')
0 files changed, 0 insertions, 0 deletions