Lines Matching defs:mode
155 /// alphanumeric, or byte mode to encode the text.
163 /// data capacities per version, ECC level, and text encoding mode.
213 /// If successful, the resulting QR Code will use byte mode to encode the data.
219 /// data capacities per version, ECC level, and text encoding mode.
285 bb.append_bits(seg.mode.mode_bits(), 4);
286 bb.append_bits(u32::try_from(seg.numchars).unwrap(), seg.mode.num_char_count_bits(version));
1077 // The mode indicator of this segment. Accessed through mode().
1078 mode: QrSegmentMode,
1081 // numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
1089 // The character count (numchars) must agree with the mode and the bit buffer length.
1099 /// Returns a segment representing the given binary data encoded in byte mode.
1103 /// Any text string can be converted to UTF-8 bytes and encoded as a byte mode segment.
1109 /// Returns a segment representing the given string of decimal digits encoded in numeric mode.
1133 /// Returns a segment representing the given text string encoded in alphanumeric mode.
1145 .expect("String contains unencodable characters in alphanumeric mode");
1184 /// The character count (numchars) must agree with the mode and
1186 pub fn new(mode: QrSegmentMode, numchars: usize, data: &'a [u8], bitlength: usize) -> Self {
1188 Self { mode, numchars, data, bitlength }
1194 /// Returns the mode indicator of this segment.
1195 pub fn mode(&self) -> QrSegmentMode {
1196 self.mode
1209 /// containing the given number of characters using the given mode, or None if the
1213 /// - For byte mode, numchars measures the number of bytes, not Unicode code points.
1214 /// - For ECI mode, numchars must be 0, and the worst-case number of bytes is returned.
1216 pub fn calc_buffer_size(mode: QrSegmentMode, numchars: usize) -> Option<usize> {
1217 let temp = Self::calc_bit_length(mode, numchars)?;
1223 // containing the given number of characters using the given mode,
1225 // - For byte mode, numchars measures the number of bytes, not Unicode code points.
1226 // - For ECI mode, numchars must be 0, and the worst-case number of bits is returned.
1228 fn calc_bit_length(mode: QrSegmentMode, numchars: usize) -> Option<usize> {
1237 match mode {
1256 let ccbits: u8 = seg.mode.num_char_count_bits(version);
1270 /// Tests whether the given string can be encoded as a segment in numeric mode.
1277 /// Tests whether the given string can be encoded as a segment in alphanumeric mode.
1287 // The set of all legal characters in alphanumeric mode,
1309 // representing the mode indicator bits for this mode object.
1322 // Returns the bit width of the character count field for a segment in this mode
1401 /// - Change the text to fit the character set of a particular segment mode (e.g. alphanumeric).