This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum State { | |
Static, | |
Queue (Vec<State>), | |
Paral (Vec<State>), | |
Loop (i64, Box<State>, Box<State>), | |
Func (Rc<Box<StateFn>>, Timer), | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Sprite { | |
image: Image, | |
transform: Transform, | |
pixel_factor: Color, | |
state: State, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn curve(ms: Ms, p: [Vec2<f32>; 4]) -> State { | |
time_func(Timer::new(ms), box move |sprite, timer| -> Option<State> { | |
// Cubic Bézier curves | |
use num::Float; | |
if timer.is_out() { return Some (Static) } | |
let t = timer.ratio(); | |
let r = 1.0 - t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class People: | |
def __add__(other: People): | |
pass | |
a = People() | |
b = People() | |
a + b # 社会秩序乱了! | |
class Noble: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::ops::DerefMut; | |
use std::ops::Deref; | |
#[derive(Show)] | |
struct List<T> { | |
car: T, | |
cdr: Option<Box<List<T>>>, | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::boxed::Box; | |
struct X; | |
struct A {x: Option<Box<X>>} | |
fn main() { | |
let mut a = Box::new(A{x: Some(Box::new(X))}); | |
let mut b = &mut a; | |
let mut c = b.x.take(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::ops::DerefMut; | |
use std::ops::Deref; | |
#[derive(Show)] | |
struct List<T> { | |
car: T, | |
cdr: Option<Box<List<T>>>, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::ops::DerefMut; | |
use std::ops::Deref; | |
struct List<T> { | |
car: T, | |
cdr: Option<Box<List<T>>>, | |
} | |
fn main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::ops::DerefMut; | |
use std::ops::Deref; | |
struct List<T> { | |
car: Option<T>, | |
cdr: Option<Box<List<T>>>, | |
} | |
fn main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct List<T> { | |
car: T, | |
cdr: Option<Box<List<T>>>, | |
} | |
fn main() { | |
let mut a = | |
List { |