bjnord

bjnord

Hands-on Rust: Chapter 3: Can't get first hello to run

Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance running Amazon Linux 2 (their customized version of RHEL 7) and Rust 1.67.1

I’m using the exact code from FirstGameFlappyAscii/hello_bterm. If I compile and run that as-is, it blows up because I don’t have Wayland/X11/etc. on this box:

 Running `target/debug/flappy`
 thread 'main' panicked at 'Failed to initialize any backend! Wayland status: NoCompositorListening X11 status: XOpenDisplayFailed', /home/bjn/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/mod.rs:719:9

The GitHub - amethyst/bracket-lib: The Roguelike Toolkit (RLTK), implemented for Rust. section on “Feature flags” says to disable default features and enable a different back-end. So first I tried this:

 $ grep feature Cargo.toml
 bracket-lib = { version = "~0.8.1", default-features = false, features = ["crossterm"] }

…but that failed with this:

 Running `target/debug/flappy`
 thread 'main' panicked at 'index out of bounds: the len is 5628 but the index is 6566', /home/bjn/.cargo/registry/src/github.com-1ecc6299db9ec823/bracket-terminal-0.8.7/src/hal/crossterm_be/main_loop.rs:229:25

And then I tried this:

 $ grep feature Cargo.toml
 bracket-lib = { version = "~0.8.1", default-features = false, features = ["curses"] }

…but that failed with this:

 Compiling bracket-terminal v0.8.7
 error[E0609]: no field `fitscreen` on type `curses::InitHints`
 --> /home/bjn/.cargo/registry/src/github.com-1ecc6299db9ec823/bracket-terminal-0.8.7/src/initializer.rs:455:29
 |
 455 |         self.platform_hints.fitscreen = fitscreen;
 |                             ^^^^^^^^^ help: a field with a similar name exists: `fullscreen`

Help? Thanks! Brent

First Post!

bjnord

bjnord

@herbert

Eventually I discovered I can get it to work by locking bracket-lib to 0.8.1 (looks like something has changed between that and the latest 0.8.7). The Cargo.toml that works for me now has:

[dependencies]
bracket-lib = { version = "=0.8.1", default-features = false, features = ["crossterm"] }
bracket-terminal = { version = "=0.8.1", default-features = false }

Popular Pragmatic Bookshelf topics Top

belgoros
Following the steps described in Chapter 6 of the book, I’m stuck with running the migration as described on page 84: bundle exec sequel...
New
brianokken
Many tasks_proj/tests directories exist in chapters 2, 3, 5 that have tests that use the custom markers smoke and get, which are not decl...
New
Alexandr
Hi everyone! There is an error on the page 71 in the book “Programming machine learning from coding to depp learning” P. Perrotta. You c...
New
mikecargal
Title: Hands-On Rust (Chapter 11: prefab) Just played a couple of amulet-less games. With a bit of debugging, I believe that your can_p...
New
Mmm
Hi, build fails on: bracket-lib = “~0.8.1” when running on Mac Mini M1 Rust version 1.5.0: Compiling winit v0.22.2 error[E0308]: mi...
New
raul
Page 28: It implements io.ReaderAt on the store type. Sorry if it’s a dumb question but was the io.ReaderAt supposed to be io.ReadAt? ...
New
conradwt
First, the code resources: Page 237: rumbl_umbrella/apps/rumbl/mix.exs Note: That this file is missing. Page 238: rumbl_umbrella/app...
New
jskubick
I’m running Android Studio “Arctic Fox” 2020.3.1 Patch 2, and I’m embarrassed to admit that I only made it to page 8 before running into ...
New
brunogirin
When running tox for the first time, I got the following error: ERROR: InterpreterNotFound: python3.10 I realised that I was running ...
New
adamwoolhether
Is there any place where we can discuss the solutions to some of the exercises? I can figure most of them out, but am having trouble with...
New

Other popular topics Top

PragmaticBookshelf
Build highly interactive applications without ever leaving Elixir, the way the experts do. Let LiveView take care of performance, scalabi...
New
AstonJ
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol: bre...
New
First poster: joeb
The File System Access API with Origin Private File System. WebKit supports new API that makes it possible for web apps to create, open,...
New
PragmaticBookshelf
Author Spotlight Mike Riley @mriley This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New
PragmaticBookshelf
Author Spotlight Erin Dees @undees Welcome to our new author spotlight! We had the pleasure of chatting with Erin Dees, co-author of ...
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
PragmaticBookshelf
Author Spotlight: Karl Stolley @karlstolley Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New
DevotionGeo
I have always used antique keyboards like Cherry MX 1800 or Cherry MX 8100 and almost always have modified the switches in some way, like...
New
AnfaengerAlex
Hello, I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New