@@ -64,11 +64,11 @@ impl<'self> ToBase64 for &'self [u8] {
64
64
*
65
65
* ```rust
66
66
* extern mod extra;
67
- * use extra::base64::{ToBase64, standard };
67
+ * use extra::base64::{ToBase64, STANDARD };
68
68
*
69
69
* fn main () {
70
- * let str = [52,32].to_base64(standard );
71
- * println!("{}", str);
70
+ * let str = [52,32].to_base64(STANDARD );
71
+ * println!("base 64 output: {}", str);
72
72
* }
73
73
* ```
74
74
*/
@@ -172,16 +172,19 @@ impl<'self> FromBase64 for &'self str {
172
172
*
173
173
* ```rust
174
174
* extern mod extra;
175
- * use extra::base64::{ToBase64, FromBase64, standard };
175
+ * use extra::base64::{ToBase64, FromBase64, STANDARD };
176
176
* use std::str;
177
177
*
178
178
* fn main () {
179
- * let hello_str = "Hello, World".to_base64(standard);
180
- * println!("{}", hello_str);
181
- * let bytes = hello_str.from_base64();
182
- * println!("{:?}", bytes);
183
- * let result_str = str::from_utf8(bytes);
184
- * println!("{}", result_str);
179
+ * let hello_str = bytes!("Hello, World").to_base64(STANDARD);
180
+ * println!("base64 output: {}", hello_str);
181
+ * let res = hello_str.from_base64();
182
+ * if res.is_ok() {
183
+ * let optBytes = str::from_utf8_opt(res.unwrap());
184
+ * if optBytes.is_some() {
185
+ * println!("decoded from base64: {}", optBytes.unwrap());
186
+ * }
187
+ * }
185
188
* }
186
189
* ```
187
190
*/
0 commit comments