diff --git a/examples/encode_string.rs b/examples/encode_string.rs index 91e9bf9..61dbb66 100644 --- a/examples/encode_string.rs +++ b/examples/encode_string.rs @@ -1,4 +1,7 @@ fn main() { - let qr_code = qr_code::QrCode::new(b"Hello").unwrap(); + let args: Vec = std::env::args().collect(); + let default = "Hello".to_string(); + let data = args.get(1).unwrap_or(&default); + let qr_code = qr_code::QrCode::new(data.as_bytes()).unwrap(); println!("{}", qr_code.to_string(true, 3)); }