Lines Matching defs:version

47 //! - User can specify minimum and maximum version numbers allowed, then library will automatically choose smallest version in the range that fits the data
49 //! - User can specify absolute error correction level, or allow the library to boost it if it doesn't increase the version number
110 /// appropriate version number, and call the `QrCode::encode_codewords()` constructor.
118 // The version number of this QR Code, which is between 1 and 40 (inclusive).
120 version: Version,
123 // 21 and 177 (inclusive). This is equal to version * 4 + 17.
154 /// QR Code version is automatically chosen for the output. The ECC level of the result may be higher than
155 /// the ecl argument if it can be done without increasing the version.
158 /// data is too long to fit in any version at the given ECC level.
168 /// bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
169 /// The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
172 /// data is too long to fit in any version at the given ECC level.
183 /// The smallest possible QR Code version is automatically chosen for the output. The ECC level
184 /// of the result may be higher than the ecl argument if it can be done without increasing the version.
191 /// data is too long to fit in any version at the given ECC level.
199 /// The smallest possible QR Code version within the given range is automatically
202 /// version. The mask number is either between 0 to 7 (inclusive) to force that
210 /// long to fit in any version in the given range at the given ECC level.
217 // Find the minimal version number to use
218 let mut version: Version = minversion;
220 let datacapacitybits: usize = QrCode::get_num_data_codewords(version, ecl) * 8; // Number of data bits available
221 let dataused: Option<usize> = QrSegment::get_total_bits(segs, version);
223 break dataused.unwrap(); // This version number is found to be suitable
224 } else if version >= maxversion { // All versions in the range could not fit the given data
230 version = Version::new(version.value() + 1);
234 // Increase the error correction level while the data still fits in the current version number
236 if boostecl && datausedbits <= QrCode::get_num_data_codewords(version, newecl) * 8 {
245 bb.append_bits(u32::try_from(seg.numchars).unwrap(), seg.mode.num_char_count_bits(version));
251 let datacapacitybits: usize = QrCode::get_num_data_codewords(version, ecl) * 8;
274 Ok(QrCode::encode_codewords(version, ecl, &datacodewords, mask))
280 /// Creates a new QR Code with the given version number,
289 version: ver,
330 /// Returns this QR Code's version, in the range [1, 40].
331 pub fn version(&self) -> Version {
332 self.version
378 // Reads this object's version field, and draws and marks all function modules.
448 // Draws two copies of the version bits (with its own error correction code),
449 // based on this object's version field, iff 7 <= version <= 40.
451 if self.version.value() < 7 {
457 let data = u32::from(self.version.value()); // uint6, in the range [7, 40]
515 // codewords appended to it, based on this object's version and error correction level.
517 let ver: Version = self.version;
561 assert_eq!(data.len(), QrCode::get_num_raw_data_modules(self.version) / 8, "Illegal argument");
695 // Returns an ascending list of positions of alignment patterns for this version number.
699 let ver: u8 = self.version.value();
715 // Returns the number of data bits that can be stored in a QR Code of the given version number, after
734 // QR Code of the given version number and error correction level, with remainder bits discarded.
1110 // segments at the given version. The result is None if a segment has too many
1112 fn get_total_bits(segs: &[Self], version: Version) -> Option<usize> {
1115 let ccbits: u8 = seg.mode.num_char_count_bits(version);
1184 // in a QR Code at the given version number. The result is in the range [0, 16].
1222 /// The error type when the supplied data does not fit any QR Code version.
1258 /// The minimum version number supported in the QR Code Model 2 standard.
1261 /// The maximum version number supported in the QR Code Model 2 standard.
1264 /// Creates a version object from the given number.