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
# This case works, using django.test.TestCase | |
# It creates the output: | |
# Good request: {'SERVER_PORT': '80', 'REQUEST_METHOD': 'POST', 'wsgi.url_scheme': 'http', 'CONTENT_LENGTH': 158, 'wsgi.input': <django.test.client.FakePayload object at 0x7f79b8287f28>, 'PATH_INFO': '/api/v0/dataset/upload', 'CONTENT_TYPE': 'multipart/form-data; boundary=BoUnDaRyStRiNg', 'QUERY_STRING': ''} | |
class DatasetAPITest2(TestCase): | |
"""Tests for uploading files to the dataset API. | |
This has to be a django.test.TestCase because APITestCase doesn't appear | |
to submit multipart/form-data properly, """ | |
@classmethod |
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 get_page(req: &mut Request) -> IronResult<Response> { | |
let ref pagename = req.extensions | |
.get::<Router>() | |
.unwrap() | |
.find("page") | |
.unwrap_or("no query"); | |
let mut pagepath = REPO_PATH.to_owned(); | |
pagepath += pagename; | |
pagepath += ".md"; |
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
// This works... | |
use specs::Join; | |
let world = self.planner.mut_world(); | |
let r1 = world.read::<CPosition>(); | |
for pos in r1.iter() { | |
println!("Position is: {:?}", pos); | |
} |
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 draw(&mut self, ctx: &mut Context) -> GameResult<()> { | |
ctx.renderer.clear(); | |
let world = self.planner.mut_world(); | |
let positions = world.read::<CPosition>(); | |
let playermarkers = world.read::<CPlayer>(); | |
let images = world.read::<CImage>(); | |
for (pos, player, image) in (&positions, &playermarkers, &images).iter() { |
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
Compiling ggez-goodies v0.1.0 (file:///home/icefox/src/ggez-goodies) | |
error[E0277]: the trait bound `f64: std::ops::Div<{integer}>` is not satisfied | |
--> examples/camera_test.rs:68:19 | |
| | |
68 | for y in -(CAMERA_HEIGHT / 2)..(CAMERA_HEIGHT / 2) { | |
| ^^^^^^^^^^^^^^^^^^^ trait `f64: std::ops::Div<{integer}>` not satisfied | |
| | |
= help: the following implementations were found: | |
= help: <f64 as std::ops::Div<&'a num_complex::Complex<f64>>> | |
= help: <&'a f64 as std::ops::Div<num_complex::Complex<f64>>> |
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 time; | |
// Single array of 10 000 000 will cause stack overflow, so outer and inner | |
const size_outer:usize = 1000; | |
const size_inner:usize = 10 * 1000; | |
fn create_vec() -> Vec<[usize;size_inner]> { | |
let mut data:Vec<[usize;size_inner]> = Vec::with_capacity(size_outer); | |
for _ in 0..size_outer { |
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
// This does not work when I uncomment color_view and depth_view | |
pub struct GraphicsContext { | |
background: pixels::Color, | |
foreground: pixels::Color, | |
window: sdl2::video::Window, | |
gl_context: sdl2::video::GLContext, | |
device: gfx_device_gl::Device, | |
factory: gfx_device_gl::Factory, | |
//color_view: gfx::handle::RenderTargetView<gfx_device_gl::Resources, gfx::format::Srgba8>, | |
//depth_view: gfx::handle::DepthStencilView<gfx_device_gl::Resources, gfx::format::DepthStencil>, |
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
[package] | |
name = "minimal" | |
version = "0.1.0" | |
[dependencies] | |
sdl2-sys = "0.27" | |
sdl2 = "0.27" | |
gfx = "0.14" | |
gfx_core = "*" | |
gfx_device_gl = "0.12" |
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 test_opengl_versions(video: &sdl2::VideoSubsystem) { | |
let major_versions = [3u8, 2u8, 1u8]; | |
let minor_versions = [3u8, 2u8, 1u8, 0u8]; | |
for major in &major_versions { | |
for minor in &minor_versions { | |
let gl = video.gl_attr(); | |
gl.set_context_version(*major, *minor); | |
// gl.set_context_profile(sdl2::video::GLProfile::Core); | |
print!("Requesting GL {}.{}... ", major, minor); |
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
2 glXChooseFBConfig(dpy = 0x7faa18679000, screen = 0, attribList = {GLX_X_RENDERABLE, True, GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR, GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_ALPHA_SIZE, 8, GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, 8, GLX_DOUBLEBUFFER, True, GLX_STEREO, False, GLX_CONFIG_CAVEAT, -1, 0}, nitems = &10) = {0xef, 0x176, 0x117, 0x18a, 0x11b, 0x18c, 0x137, 0x19a, 0x13b, 0x19c} | |
14 glXGetVisualFromFBConfig(dpy = 0x7faa18679000, config = 0xef) = &{visual = 0x7faa1869b070, visualid = 36, screen = 0, depth = 24, c_class = 4, red_mask = 16711680, green_mask = 65280, blue_mask = 255, colormap_size = 256, bits_per_rgb = 8} | |
57 glXCreateContextAttribsARB(dpy = 0x7faa18679000, config = 0xef, share_context = NULL, direct = True, attrib_list = {GLX_CONTEXT_MAJOR_VERSION_ARB, 3, GLX_CONTEXT_MINOR_VERSION_ARB, 3, GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB, 0}) = 0x7faa187f8140 | |
59 glXDestroyContext(dpy = 0x7faa18679000, ctx = 0x7faa187f8 |
OlderNewer