diff --git a/rust/src/lib.rs b/rust/src/lib.rs index d35d819..ebb972c 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -1116,17 +1116,19 @@ impl QrSegment { } - // Tests whether the given string can be encoded as a segment in numeric mode. - // A string is encodable iff each character is in the range 0 to 9. - fn is_numeric(text: &[char]) -> bool { + /// Tests whether the given string can be encoded as a segment in numeric mode. + /// + /// A string is encodable iff each character is in the range 0 to 9. + pub fn is_numeric(text: &[char]) -> bool { text.iter().all(|&c| '0' <= c && c <= '9') } - // Tests whether the given string can be encoded as a segment in alphanumeric mode. - // A string is encodable iff each character is in the following set: 0 to 9, A to Z - // (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon. - fn is_alphanumeric(text: &[char]) -> bool { + /// Tests whether the given string can be encoded as a segment in alphanumeric mode. + /// + /// A string is encodable iff each character is in the following set: 0 to 9, A to Z + /// (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon. + pub fn is_alphanumeric(text: &[char]) -> bool { text.iter().all(|c| ALPHANUMERIC_CHARSET.contains(c)) }