Permalink
Browse files

fsdfwe

  • Loading branch information...
stnbu committed Nov 12, 2018
1 parent 5b3c974 commit 82b5fbb10f1bd1d11e0f59acc456d11143d7f203
Showing with 27 additions and 2 deletions.
  1. +27 −2 src/main.rs
@@ -1,9 +1,9 @@
// Quirky, idiomatic Rust stuff...
#[allow(dead_code)]
fn get_element_n_of_string() {
let s = "mybog";
let chars: Vec<char> = s.chars().collect();
println!("{}", chars[0]);
let _chars: Vec<char> = s.chars().collect();
}
fn misreuse_of_closure() {
@@ -21,6 +21,30 @@ fn bytes_to_utf8() {
assert_eq!("💖", sparkle_heart);
}
fn s_truct() {
struct Bob(u8, u8);
let _bob = Bob(1, 1);
_bob.0;
_bob.1;
struct Mary {
staff: u8,
rod: u8,
};
let mut _m = Mary {
staff: 1,
rod: 1,
};
_m.staff;
_m.rod;
_m.rod = 2;
let _n = Mary {
staff: 1,
rod: 1,
};
//_n.rod = 7; // will fail to compile
//let _o = Mary(1, 1); // oddly does not work
}
use std::collections::HashMap;
fn hmap() {
let mut book_reviews = HashMap::new();
@@ -38,4 +62,5 @@ fn main() {
misreuse_of_closure();
bytes_to_utf8();
hmap();
s_truct();
}

0 comments on commit 82b5fbb

Please sign in to comment.