#[derive(Clone, Debug)]
struct Foo {
pub x: i32,
pub y: i32,
}
trait Bar {
fn bar(&self) -> i32;
}
impl Bar for Foo {
fn bar(&self) -> i32 {
self.x
}
}
static mut STATIC_MUT: i32 = 0;
fn foo<'a, T>() -> T {
foo::<'a, i32>()
}
macro_rules! def_fn {
($($tt:tt)*) => {$($tt)*}
}
def_fn! {
fn bar() -> u32 {
100
}
}
fn main() {
println!("Hello, {}!", 92);
let mut vec = Vec::new();
if true {
let x = 92;
vec.push(Foo { x, y: 1 });
}
unsafe {
vec.set_len(0);
STATIC_MUT = 1;
}
for e in vec {
}
let mut x = 42;
let y = &mut x;
let z = &y;
y;
}
enum Option<T> {
Some(T),
None,
}
use Option::*;
impl<T> Option<T> {
fn and<U>(self, other: Option<U>) -> Option<(T, U)> {
match other {
None => unimplemented!(),
Nope => Nope,
}
}
}