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
115 /// appropriate version number, and call the `QrCode::encode_codewords()` constructor.
121 // 21 and 177 (inclusive). This is equal to version * 4 + 17.
136 /// If the data is too long to fit in any version in the given range
139 /// The smallest possible QR Code version within the given range is automatically
142 /// version. The mask number is either between 0 to 7 (inclusive) to force that
157 /// In the most optimistic case, a QR Code at version 40 with low ECC
163 /// data capacities per version, ECC level, and text encoding mode.
172 let (datacodewordslen, ecl, version) = QrCode::encode_segments_to_codewords(&[], outbuffer, ecl, minversion, maxversion, boostecl)?;
173 return Ok(Self::encode_codewords(outbuffer, datacodewordslen, tempbuffer, ecl, version, mask));
187 let (datacodewordslen, ecl, version) = QrCode::encode_segments_to_codewords(&[seg], outbuffer, ecl, minversion, maxversion, boostecl)?;
188 Ok(Self::encode_codewords(outbuffer, datacodewordslen, tempbuffer, ecl, version, mask))
193 /// If the data is too long to fit in any version in the given range
196 /// The smallest possible QR Code version within the given range is automatically
199 /// version. The mask number is either between 0 to 7 (inclusive) to force that
215 /// In the most optimistic case, a QR Code at version 40 with low ECC can hold any byte
219 /// data capacities per version, ECC level, and text encoding mode.
231 let (datacodewordslen, ecl, version) = QrCode::encode_segments_to_codewords(&[seg], outbuffer, ecl, minversion, maxversion, boostecl)?;
232 Ok(Self::encode_codewords(outbuffer, datacodewordslen, dataandtempbuffer, ecl, version, mask))
241 /// The smallest possible QR Code version within the given range is automatically
244 /// version. The mask number is either between 0 to 7 (inclusive) to force that
257 // Find the minimal version number to use
258 let mut version: Version = minversion;
260 let datacapacitybits: usize = QrCode::get_num_data_codewords(version, ecl) * 8; // Number of data bits available
261 let dataused: Option<usize> = QrSegment::get_total_bits(segs, version);
263 break dataused.unwrap(); // This version number is found to be suitable
264 } else if version >= maxversion { // All versions in the range could not fit the given data
270 version = Version::new(version.value() + 1);
274 // Increase the error correction level while the data still fits in the current version number
276 if boostecl && datausedbits <= QrCode::get_num_data_codewords(version, newecl) * 8 {
282 let datacapacitybits: usize = QrCode::get_num_data_codewords(version, ecl) * 8;
286 bb.append_bits(u32::try_from(seg.numchars).unwrap(), seg.mode.num_char_count_bits(version));
308 Ok((bb.length / 8, ecl, version))
314 /// Creates a new QR Code with the given version number,
320 ecl: QrCodeEcc, version: Version, mut msk: Option<Mask>) -> QrCode<'a> {
322 datacodewordsandoutbuffer = &mut datacodewordsandoutbuffer[ .. version.buffer_len()];
323 tempbuffer = &mut tempbuffer [ .. version.buffer_len()];
326 let rawcodewords: usize = QrCode::get_num_raw_data_modules(version) / 8;
329 let allcodewords = Self::add_ecc_and_interleave(data, version, ecl, temp, tempbuffer);
332 let mut result: QrCode = QrCode::<'a>::function_modules_marked(datacodewordsandoutbuffer, version);
335 let funcmods: QrCode = QrCode::<'b>::function_modules_marked(tempbuffer, version); // Just a grid, not a real QR Code
361 /// Returns this QR Code's version, in the range [1, 40].
362 pub fn version(&self) -> Version {
485 // version's size, then marks every function module as dark.
518 // Fill version blocks
567 // Draw version blocks
568 let ver = u32::from(self.version().value()); // uint6, in the range [7, 40]
646 assert_eq!(data.len(), QrCode::get_num_raw_data_modules(self.version()) / 8, "Illegal argument");
790 // for this version number, returning a slice of resultbuf.
794 let ver: u8 = self.version().value();
812 // Returns the number of data bits that can be stored in a QR Code of the given version number, after
831 // QR Code of the given version number and error correction level, with remainder bits discarded.
1251 // segments at the given version. The result is None if a segment has too many
1253 fn get_total_bits(segs: &[Self], version: Version) -> Option<usize> {
1256 let ccbits: u8 = seg.mode.num_char_count_bits(version);
1323 // in a QR Code at the given version number. The result is in the range [0, 16].
1393 /// The error type when the supplied data does not fit any QR Code version.
1425 /// The minimum version number supported in the QR Code Model 2 standard.
1428 /// The maximum version number supported in the QR Code Model 2 standard.
1431 /// Creates a version object from the given number.
1445 /// buffers when creating a QR Code of this version number.