pub fn make_numeric(text: &str) -> Self {
        let mut bb = BitBuffer(Vec::with_capacity(text.len() * 3 + (text.len() + 2) / 3));
        let mut accumdata: u32 = 0;
        let mut accumcount: u8 = 0;
        for b in text.bytes() {
            assert!(
                (b'0'..=b'9').contains(&b),
                "String contains non-numeric characters"
            );
            accumdata = accumdata * 10 + u32::from(b - b'0');
            accumcount += 1;
            if accumcount == 3 {
                bb.append_bits(accumdata, 10);
                accumdata = 0;
                accumcount = 0;
            }
        }
        if accumcount > 0 {
            // 1 or 2 digits remaining
            bb.append_bits(accumdata, accumcount * 3 + 1);
        }
        QrSegment::new(QrSegmentMode::Numeric, text.len(), bb.0)
    }
/// Returns a segment representing the given string of decimal digits encoded in numeric mode.
///
/// Panics if the string contains non-digit characters.
Returns a segment representing the given string of decimal digits encoded in numeric mode.
Panics if the string contains non-digit characters.
Returns a segment representing the given string of decimal digits encoded in numeric mode . Panics if the string contains non - digit characters .
pub fn make_numeric(text: &str) -> Self {
        let mut bb = BitBuffer(Vec::with_capacity(text.len() * 3 + (text.len() + 2) / 3));
        let mut accumdata: u32 = 0;
        let mut accumcount: u8 = 0;
        for b in text.bytes() {
            assert!(
                (b'0'..=b'9').contains(&b),
                "String contains non-numeric characters"
            );
            accumdata = accumdata * 10 + u32::from(b - b'0');
            accumcount += 1;
            if accumcount == 3 {
                bb.append_bits(accumdata, 10);
                accumdata = 0;
                accumcount = 0;
            }
        }
        if accumcount > 0 {
            // 1 or 2 digits remaining
            bb.append_bits(accumdata, accumcount * 3 + 1);
        }
        QrSegment::new(QrSegmentMode::Numeric, text.len(), bb.0)
    }
pub fn make_numeric ( text : & str ) -> Self { let mut bb = BitBuffer ( Vec :: with_capacity ( text . len ( ) * 3 + ( text . len ( ) + 2 ) / 3 ) ) ; let mut accumdata : u32 = 0 ; let mut accumcount : u8 = 0 ; for b in text . bytes ( ) { assert ! ( ( b'0' b'9' ) contains ( b ) " " ) ; accumdata = accumdata * 10 + u32 :: from ( b - b'0' ) ; accumcount += 1 ; if accumcount == 3 { bb . append_bits ( accumdata , 10 ) ; accumdata = 0 ; accumcount = 0 ; } } if accumcount > 0 { // 1 or 2 digits remaining bb . append_bits ( accumdata , accumcount * 3 + 1 ) ; } QrSegment :: new ( QrSegmentMode :: Numeric , text . len ( ) , bb . 0 ) }
Returns a segment representing the given string of decimal digits encoded in numeric mode.
Returns a segment representing the given string of decimal digits encoded in numeric mode .
text
&str