Changed a top-level Rust function to take &str instead of &[char].

This commit is contained in:
Project Nayuki 2017-08-27 23:49:31 +00:00
parent dd9d822950
commit 8b9caed527
1 changed files with 3 additions and 2 deletions

View File

@ -52,8 +52,9 @@ pub struct QrCode {
impl QrCode {
pub fn encode_text(text: &[char], ecl: &'static QrCodeEcc) -> QrCode {
let segs: Vec<QrSegment> = QrSegment::make_segments(text);
pub fn encode_text(text: &str, ecl: &'static QrCodeEcc) -> QrCode {
let chrs: Vec<char> = text.chars().collect();
let segs: Vec<QrSegment> = QrSegment::make_segments(&chrs);
QrCode::encode_segments(&segs, ecl)
}