From c8e1b0caed500afb33cae32c574e4a5c8aaa3321 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Sun, 1 Aug 2021 00:18:51 +0000 Subject: [PATCH] Fixed example code in Rust documentation, related to commits a88f0942afe7 and 3da57e5aa01e. --- rust/Readme.markdown | 6 ++++-- rust/src/lib.rs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/rust/Readme.markdown b/rust/Readme.markdown index 8c5309b..f14a66d 100644 --- a/rust/Readme.markdown +++ b/rust/Readme.markdown @@ -35,9 +35,11 @@ Examples -------- extern crate qrcodegen; + use qrcodegen::Mask; use qrcodegen::QrCode; use qrcodegen::QrCodeEcc; use qrcodegen::QrSegment; + use qrcodegen::Version; // Simple operation let qr = QrCode::encode_text("Hello, world!", @@ -47,8 +49,8 @@ Examples // Manual operation let chrs: Vec = "3141592653589793238462643383".chars().collect(); let segs = QrSegment::make_segments(&chrs); - let qr = QrCode::encode_segments_advanced( - &segs, QrCodeEcc::High, 5, 5, Some(Mask::new(2)), false).unwrap(); + let qr = QrCode::encode_segments_advanced(&segs, QrCodeEcc::High, + Version::new(5), Version::new(5), Some(Mask::new(2)), false).unwrap(); for y in 0 .. qr.size() { for x in 0 .. qr.size() { (... paint qr.get_module(x, y) ...) diff --git a/rust/src/lib.rs b/rust/src/lib.rs index ebb972c..eded602 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -54,9 +54,11 @@ //! //! ``` //! extern crate qrcodegen; +//! use qrcodegen::Mask; //! use qrcodegen::QrCode; //! use qrcodegen::QrCodeEcc; //! use qrcodegen::QrSegment; +//! use qrcodegen::Version; //! ``` //! //! Simple operation: @@ -72,8 +74,8 @@ //! ``` //! let chrs: Vec = "3141592653589793238462643383".chars().collect(); //! let segs = QrSegment::make_segments(&chrs); -//! let qr = QrCode::encode_segments_advanced( -//! &segs, QrCodeEcc::High, 5, 5, Some(Mask::new(2)), false).unwrap(); +//! let qr = QrCode::encode_segments_advanced(&segs, QrCodeEcc::High, +//! Version::new(5), Version::new(5), Some(Mask::new(2)), false).unwrap(); //! for y in 0 .. qr.size() { //! for x in 0 .. qr.size() { //! (... paint qr.get_module(x, y) ...)