From 0860fee6bee6b763d342fb0259fa837622af319b Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Mon, 27 Aug 2018 02:47:33 +0000 Subject: [PATCH] Simplified example Rust code in readme. --- Readme.markdown | 12 ++++++------ rust/Readme.markdown | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Readme.markdown b/Readme.markdown index 0ee2926..a35dd85 100644 --- a/Readme.markdown +++ b/Readme.markdown @@ -173,18 +173,18 @@ Rust language: use qrcodegen::QrSegment; // Simple operation - let qr0 = QrCode::encode_text("Hello, world!", + let qr = QrCode::encode_text("Hello, world!", QrCodeEcc::Medium).unwrap(); - let svg = qr0.to_svg_string(4); + let svg = qr.to_svg_string(4); // Manual operation let chrs: Vec = "3141592653589793238462643383".chars().collect(); let segs = QrSegment::make_segments(&chrs); - let qr1 = QrCode::encode_segments_advanced( + let qr = QrCode::encode_segments_advanced( &segs, QrCodeEcc::High, 5, 5, Some(2), false).unwrap(); - for y in 0 .. qr1.size() { - for x in 0 .. qr1.size() { - (... paint qr1.get_module(x, y) ...) + for y in 0 .. qr.size() { + for x in 0 .. qr.size() { + (... paint qr.get_module(x, y) ...) } } diff --git a/rust/Readme.markdown b/rust/Readme.markdown index fd8cb50..55ae530 100644 --- a/rust/Readme.markdown +++ b/rust/Readme.markdown @@ -39,18 +39,18 @@ Examples use qrcodegen::QrSegment; // Simple operation - let qr0 = QrCode::encode_text("Hello, world!", + let qr = QrCode::encode_text("Hello, world!", QrCodeEcc::Medium).unwrap(); - let svg = qr0.to_svg_string(4); + let svg = qr.to_svg_string(4); // Manual operation let chrs: Vec = "3141592653589793238462643383".chars().collect(); let segs = QrSegment::make_segments(&chrs); - let qr1 = QrCode::encode_segments_advanced( + let qr = QrCode::encode_segments_advanced( &segs, QrCodeEcc::High, 5, 5, Some(2), false).unwrap(); - for y in 0 .. qr1.size() { - for x in 0 .. qr1.size() { - (... paint qr1.get_module(x, y) ...) + for y in 0 .. qr.size() { + for x in 0 .. qr.size() { + (... paint qr.get_module(x, y) ...) } }