rustup.
This commit is contained in:
parent
4fd82eca2a
commit
9f2adaad82
|
@ -2,7 +2,7 @@
|
|||
name = "qrcode"
|
||||
description = "QR code encoder in Rust"
|
||||
license = "Apache-2.0"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
authors = ["kennytm <kennytm@gmail.com>"]
|
||||
keywords = ["qrcode"]
|
||||
repository = "https://github.com/kennytm/qrcode-rust"
|
||||
|
|
|
@ -88,7 +88,7 @@ fn interleave<T: Copy, V: Deref<Target=[T]>>(blocks: &Vec<V>) -> Vec<T> {
|
|||
|
||||
#[test]
|
||||
fn test_interleave() {
|
||||
let res = interleave(&vec![b"1234".as_slice(), b"5678", b"abcdef", b"ghijkl"]);
|
||||
let res = interleave(&vec![&b"1234"[..], b"5678", b"abcdef", b"ghijkl"]);
|
||||
assert_eq!(&*res, b"15ag26bh37ci48djekfl");
|
||||
}
|
||||
|
||||
|
@ -147,9 +147,9 @@ mod construct_codewords_test {
|
|||
let msg = b"CUF\x86W&U\xc2w2\x06\x12\x06g&\xf6\xf6B\x07v\x86\xf2\x07&V\x16\xc6\xc7\x92\x06\xb6\xe6\xf7w2\x07v\x86W&R\x06\x86\x972\x07F\xf7vV\xc2\x06\x972\x10\xec\x11\xec\x11\xec\x11\xec";
|
||||
let (blocks_vec, ec_vec) = construct_codewords(msg, Version::Normal(5), EcLevel::Q).unwrap();
|
||||
assert_eq!(&*blocks_vec,
|
||||
b"C\xf6\xb6FU\xf6\xe6\xf7FB\xf7v\x86\x07wVWv2\xc2&\x86\x07\x06U\xf2v\x97\xc2\x07\x862w&W\x102V&\xec\x06\x16R\x11\x12\xc6\x06\xec\x06\xc7\x86\x11g\x92\x97\xec&\x062\x11\x07\xec".as_slice());
|
||||
&b"C\xf6\xb6FU\xf6\xe6\xf7FB\xf7v\x86\x07wVWv2\xc2&\x86\x07\x06U\xf2v\x97\xc2\x07\x862w&W\x102V&\xec\x06\x16R\x11\x12\xc6\x06\xec\x06\xc7\x86\x11g\x92\x97\xec&\x062\x11\x07\xec"[..]);
|
||||
assert_eq!(&*ec_vec,
|
||||
b"\xd5W\x94\xeb\xc7\xcct\x9f\x0b`\xb1\x05-<\xd4\xads\xcaL\x18\xf7\xb6\x85\x93\xf1|K;\xdf\x9d\xf2!\xe5\xc8\xeej\xf8\x86L(\x9a\x1b\xc3\xffu\x81\xe6\xac\x9a\xd1\xbdRo\x11\n\x02V\xa3l\x83\xa1\xa3\xf0 ox\xc0\xb2'\x85\x8d\xec".as_slice());
|
||||
&b"\xd5W\x94\xeb\xc7\xcct\x9f\x0b`\xb1\x05-<\xd4\xads\xcaL\x18\xf7\xb6\x85\x93\xf1|K;\xdf\x9d\xf2!\xe5\xc8\xeej\xf8\x86L(\x9a\x1b\xc3\xffu\x81\xe6\xac\x9a\xd1\xbdRo\x11\n\x02V\xa3l\x83\xa1\xa3\xf0 ox\xc0\xb2'\x85\x8d\xec"[..]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ impl QrCode {
|
|||
impl Index<(usize, usize)> for QrCode {
|
||||
type Output = bool;
|
||||
|
||||
fn index(&self, &(x, y): &(usize, usize)) -> &bool {
|
||||
fn index(&self, (x, y): (usize, usize)) -> &bool {
|
||||
let index = y * self.width + x;
|
||||
&self.content[index]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue