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 Control { | |
pub id: i32, | |
} | |
struct UI<'a> { | |
pub control: &'a Control, | |
} | |
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
trait Rendered { | |
fn render(&mut self); | |
} | |
struct TextLabel { | |
} | |
impl Rendered for TextLabel { | |
fn render(&mut self) { | |
println!("TextLabel"); |
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
#![allow(unused)] | |
pub mod sdl { | |
pub struct Sdl2<'a> { | |
pub version: &'a str | |
} | |
impl<'a> Sdl2<'a> { |
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
#![allow(unused)] | |
#[derive(Debug)] | |
struct TextEngine { | |
id: u32, | |
} | |
#[derive(Debug)] | |
struct Ui { | |
engine: TextEngine, |
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 main() { | |
let s1 = "hello"; | |
let s2 = String::from("hello"); | |
let s3 = String::from("hello"); | |
println!("s1 == s2 => {}", s1 == s2); | |
println!("s1 == s3 => {}", s1 == s3); | |
println!("s2 == s3 => {}", s2 == s3); | |
} |
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
const FIZZABLE: u8 = 3; | |
const BUZZABLE: u8 = 5; | |
const FIZZBUZZABLE: u8 = FIZZABLE * BUZZABLE; | |
fn main() { | |
for i in 1..101 { | |
if i % FIZZBUZZABLE == 0 { | |
print!("FizzBuzz"); | |
} | |
else if i % BUZZABLE == 0 { |
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
#[derive(Debug)] | |
struct Node<'a> { | |
id: &'a str, | |
children: Option<Vec<Node<'a>>>, | |
} | |
fn make_leaf<'a>(id: &'a str) -> Node<'a> { | |
Node { | |
id: id, | |
children: None |
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
// Filled circle algorithm with edge softening | |
fn main() { | |
let w = 12; | |
let r: f32 = w as f32 / 2.0; | |
println!("================================================="); | |
println!("radius: {}", r); | |
println!("================================================="); | |
println!("col,row -> dx,dy -> dist from center -> diff -> alpha"); | |
println!("================================================="); |
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
<!doctype html> | |
<style>body { padding: 0; }</style> | |
<script src='https://cdn.jsdelivr.net/p5.js/0.3.2/p5.min.js'></script> | |
<script src='out/goog/base.js'></script> | |
<script src='myproject.js'></script> | |
<script>goog.require('myproject.core')</script> |
OlderNewer