Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // fn main() {
- // let v = vec![1, 2, 3, 4, 6];
- // let x = |x| x % 3;
- // for i in v {
- // println!("{:?}, {:?}", x(i), foo(i));
- // }
- // fn foo(x: i32) -> i32 {
- // x * 2
- // }
- // }
- /// ----
- // fn main() {
- // let ans = call_with_one(|x| x + 2);
- // println!("{}", ans);
- // }
- // fn call_with_one<F>(some_closure: F) -> i32
- // where F: Fn(i32) -> i32 {
- // some_closure(32)
- // }
- /// ----
- // use std::ops::Add;
- // #[derive(Debug)]
- // struct Point{
- // x: i32,
- // y: i32,
- // }
- // impl Add for Point {
- // type Output = Point;
- // fn add(self, other: Point) -> Point {
- // Point {
- // x: self.x + other.x,
- // y: self.y + other.y,
- // }
- // }
- // }
- // fn main() {
- // let p1 = Point {x: 1, y: 0};
- // let p2 = Point {x: 4, y: -6};
- // let p = p1 + p2;
- // println!("{:?}", p);
- // }
- /// -----
- fn main() {
- let x = 5;
- let raw = &x as *const i32;
- let point_at = unsafe { *raw };
- println!("{}", point_at);
- }
Add Comment
Please, Sign In to add comment