servo / pathfinder

A fast, practical GPU rasterizer for fonts and vector graphics
Apache License 2.0
3.6k stars 201 forks source link

Error building `canvas_nanovg` example #376

Closed XX closed 4 years ago

XX commented 4 years ago

When I run the following

cd examples/canvas_nanovg
cargo run --release

I get these compilation errors:

   Compiling canvas_nanovg v0.1.0 (/home/xx/data/projects/rusts/pathfinder/examples/canvas_nanovg)
error[E0599]: no function or associated item named `default_for_device` found for struct `pathfinder_renderer::gpu::options::RendererOptions<_>` in the current scope
    --> examples/canvas_nanovg/src/main.rs:1522:28
     |
1522 |         ..RendererOptions::default_for_device(&pathfinder_device)
     |                            ^^^^^^^^^^^^^^^^^^ function or associated item not found in `pathfinder_renderer::gpu::options::RendererOptions<_>`

error[E0308]: mismatched types
    --> examples/canvas_nanovg/src/main.rs:1526:38
     |
1526 | ...                   DestFramebuffer::full_window(framebuffer_size),
     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `pathfinder_renderer::gpu::options::RendererMode`, found enum `pathfinder_renderer::gpu::options::DestFramebuffer`
     |
     = note: expected struct `pathfinder_renderer::gpu::options::RendererMode`
                  found enum `pathfinder_renderer::gpu::options::DestFramebuffer<_>`

error[E0599]: no method named `level` found for struct `pathfinder_renderer::gpu::renderer::Renderer<pathfinder_gl::GLDevice>` in the current scope
    --> examples/canvas_nanovg/src/main.rs:1571:57
     |
1571 | ...                   renderer.level(),
     |                                ^^^^^ method not found in `pathfinder_renderer::gpu::renderer::Renderer<pathfinder_gl::GLDevice>`

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0308, E0599.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `canvas_nanovg`.

To learn more, run the command again with --verbose.

Why doesn't the example compile?