Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
If you are using WebRender and you get a MaxTextureSize error, | |
the problem is that the OpenGL context is broken. When calling | |
Renderer::new(), the context you are binding to *must be current*. | |
Otherwise, Renderer::new() will crash with a assert!(0, 1282) in | |
debug and a MaxTextureSize error in release mode. |
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
Show hidden characters
{ | |
"name": "Rust color scheme", | |
"rules": [ | |
/* --- grey items --- */ | |
{ | |
"scope": "comment", | |
"foreground": "color(var(black) blend(#fff 50%))", | |
}, | |
/* --- red items --- */ | |
{ |
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
extern crate itoa; | |
extern crate smallvec; | |
macro_rules! print_time { | |
($start:expr, $end:expr) => (println!("time: {} ns", ($end - $start).subsec_nanos() as f32 / 1_000_000.0);) | |
} | |
// 189 ns | |
fn new_order_slow(stock: &str, price: i32, quantity: i32) -> String { | |
format!("NEW {} {} {}", stock, price, quantity) |
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
pub enum MyMarker { }; | |
let a = MyMarker{ }; // no! | |
let b = MyMarker; // no! | |
let c = MyMarker:: ; // ??? |
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
mod private_module { | |
pub struct PublicStruct; | |
} | |
pub fn public_function() -> PublicStruct { /* ... */ } |
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
#[cfg(not(use_double_precision))] | |
pub type fsize = f32; | |
#[cfg(use_double_precision)] | |
pub type fsize = f64; | |
let x: fsize = 50.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
fn insertion_sort(data: &mut Vec<u8>) { | |
if data.len() < 2 { return; /* already sorted */ } | |
for j in 1..data.len() { | |
let key = data[j]; | |
let mut i = (j as i8) - 1; | |
while i >= 0 && data[i as usize] > key { | |
data[(i + 1) as usize] = data[i as usize]; |
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
I can't say that this will work for everyone, but here's what I did: | |
First, list the input devices: | |
xinput list | |
You should get output like this: | |
⎡ Virtual core pointer id=2 [master pointer (3)] | |
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] |
NewerOlder