Skip to content

Turtle on wayland not working #266

@klownie

Description

@klownie

I'm running a code using turtle and it seems to not compile because of a Wayland issue I'm guessing.
I'm using arch with newm-atha-git as the wm.
kernel : 6.3.5-zen1-1-zen
with no NVIDIA drivers running.
here's code :

use std::collections::HashMap;
use turtle::Turtle;

fn derive_iter<'a>(þ: &'a mut String, n: usize, p: &Vec<&str>) {
    let mut rules: HashMap<char, String> = HashMap::new();

    for rule in p {
        let parts: Vec<&str> = rule.split("->").map(|s| s.trim()).collect();
        if let [lhs, rhs] = parts.as_slice() {
            let key = lhs.chars().next().unwrap();
            rules.insert(key, rhs.to_string());
        }
    }

    for _ in 0..n {
        let mut deriv_þ = String::new();
        for character in þ.chars() {
            if let Some(rule) = rules.get(&character) {
                deriv_þ.push_str(rule);
            } else {
                deriv_þ.push(character);
            }
        }
        *þ = deriv_þ;
    }
}

fn dessiner(turtle: &mut Turtle, chaine: String, longeur: f64, angle: f64) {
    for character in chaine.chars() {
        match character {
            '+' => turtle.right(angle),
            '-' => turtle.left(angle),
            _ => turtle.forward(longeur),
        }
    }
}

fn main() {
    let mut þ = "F+F+F+F".to_owned();
    let p = vec!["F -> F+f-FF+F+FF+Ff+FF-f+FF-F-FF-Ff-FFF", "f -> ffffff"];
    derive_iter(&mut þ, 1, &p);
    println!("la derive est: {}", þ);

    let mut turtle = Turtle::new();
    turtle.pen_down();
    dessiner(&mut turtle, þ, 15.0, 90.0);
}

here is error traceback :

    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `target/debug/les-systemes-de-lindenmayer`
la derive est: F+f-FF+F+FF+Ff+FF-f+FF-F-FF-Ff-FFF+F+f-FF+F+FF+Ff+FF-f+FF-F-FF-Ff-FFF+F+f-FF+F+FF+Ff+FF-f+FF-F-FF-Ff-FFF+F+f-FF+F+FF+Ff+FF-f+FF-F-FF-Ff-FFF
thread '<unnamed>' panicked at 'bug: failed to read response from renderer process', /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/turtle-1.0.0-rc.3/src/messenger.rs:41:69
stack backtrace:
interface 'wl_output' has no event 4
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 0, kind: Uncategorized, message: "Success" }', /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platf
orm/linux/wayland/event_loop.rs:143:11
stack backtrace:
   0: rust_begin_unwind
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/panicking.rs:64:14
   2: core::result::unwrap_failed
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/result.rs:1791:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/result.rs:1113:23
   4: winit::platform::platform::wayland::event_loop::EventsLoop::new
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/linux/wayland/event_loop.rs:126:19
   5: winit::platform::platform::EventsLoop::new_wayland
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/linux/mod.rs:471:9
   6: winit::platform::platform::EventsLoop::new
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/linux/mod.rs:442:28
   7: winit::EventsLoop::new
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/lib.rs:251:26
   8: glutin_window::GlutinWindow::new
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/pistoncore-glutin_window-0.63.0/src/lib.rs:114:27
   9: <glutin_window::GlutinWindow as window::BuildFromWindowSettings>::build_from_window_settings
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/pistoncore-glutin_window-0.63.0/src/lib.rs:455:9
  10: window::WindowSettings::build
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/pistoncore-window-0.44.0/src/lib.rs:465:9
  11: <piston_window::PistonWindow<W> as window::BuildFromWindowSettings>::build_from_window_settings
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/piston_window-0.105.0/src/lib.rs:189:47
   0: std::panicking::begin_panic
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/panicking.rs:607:12
   1: turtle::messenger::read_forever::{{closure}}
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/turtle-1.0.0-rc.3/src/messenger.rs:41:69
   2: core::result::Result<T,E>::map_err
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/result.rs:861:27
   3: turtle::messenger::read_forever
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/turtle-1.0.0-rc.3/src/messenger.rs:34:22
   4: turtle::renderer_process::desktop::RendererProcess::new::{{closure}}
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/turtle-1.0.0-rc.3/src/renderer_process/desktop.rs:37:13
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
  12: window::WindowSettings::build
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/pistoncore-window-0.44.0/src/lib.rs:465:9
  13: turtle::renderer::Renderer::run
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/turtle-1.0.0-rc.3/src/renderer.rs:79:40
  14: turtle::server::main
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/turtle-1.0.0-rc.3/src/server.rs:90:5
  15: turtle::server::start
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/turtle-1.0.0-rc.3/src/server.rs:66:9
  16: turtle::turtle_window::TurtleWindow::new
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/turtle-1.0.0-rc.3/src/turtle_window.rs:23:9
  17: turtle::turtle::Turtle::new
             at /home/klownie/.cargo/registry/src/github.com-1ecc6299db9ec823/turtle-1.0.0-rc.3/src/turtle.rs:86:43
  18: les_systemes_de_lindenmayer::main
             at ./src/main.rs:44:22
  19: core::ops::function::FnOnce::call_once
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/ops/function.rs:507:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions