GithubHelp home page GithubHelp logo

extrawurst / rust-webview-todomvc-yew Goto Github PK

View Code? Open in Web Editor NEW
106.0 2.0 8.0 974 KB

lightweight desktop todomvc implementation using rust,wasm and web-view

Rust 94.05% HTML 3.16% Makefile 2.79%
rust-lang rust todomvc wasm webview

rust-webview-todomvc-yew's Introduction

screenshot

rust todomvc desktop app

Demo how to use yew for a todomvc implementation written in rust that compiles to wasm and is bundled as a lightweight desktop app using web-view and serves it's static files using hyper.

This prduces a slim ~2 mb executable compared to hundreds with electron.

run

use make run to try it. this requires cargo web to be installed.

rust-webview-todomvc-yew's People

Contributors

imgbotapp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rust-webview-todomvc-yew's Issues

Not working on Windows 10

The application builds and loads, but it immediately shows a page with an HTTP 404 error, and unfortunately the app is not picked up by Microsoft Edge DevTools Preview.

Panic when processing todomvc.wasm

I cloned this project, installed cargo-web and tried to run it with make run. This leads to the following panic while processing todomvc.wasm:

    Processing "todomvc.wasm"...                                                                                                                                  
thread 'main' panicked at 'unknown name section chunk type: 7', /home/myusername/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-web-0.6.26/src/wasm_context.rs:642:
41                                                                                                                                                                
stack backtrace:                                                                                                                                                  
   0: rust_begin_unwind                                                                                                                                           
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:517:5
   1: std::panicking::begin_panic_fmt                                                                                                                             
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:460:5
   2: cargo_web::wasm_context::Context::from_module
   3: cargo_web::wasm::process_wasm_file 
   4: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
   5: cargo_web::cargo_shim::BuildConfig::build_internal
   6: cargo_web::cargo_shim::BuildConfig::build
   7: cargo_web::build::Project::build_or_check
   8: cargo_web::cmd_build::command_build_or_check
   9: cargo_web::run
  10: cargo_web::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
make: *** [Makefile:13: build-wasm] Error 101

Details

  • Operating System: Ubuntu 20.04.3 LTS (focal)
  • Cargo Version: cargo 1.56.0 (4ed5d137b 2021-10-04)
  • Cargo-Web Version: cargo-web 0.6.26

Dependency issue

Hey, I said last week that I'd try this out and report how that went.

Sadly, my assumption that my Linux distro, Nixos, would get in the way, was correct.

Using make run I ran into the following error, which was expected:

error: failed to run custom build command for `webview-sys v0.3.2`

Caused by:
  process didn't exit successfully: `/home/hzimmerman/rnd/rust-webview-todomvc-yew/target/debug/build/webview-sys-966ee743bf2ab62a/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Command { command: "\"pkg-config\" \"--libs\" \"--cflags\" \"webkit2gtk-4.0\" \"webkit2gtk-4.0 >= 2.8\"", cause: Os { code: 2, kind: NotFound, message: "No such file or directory" } }', src/libcore/result.rs:1165:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

To remedy that, I tried installing webview via go get github.com/zserge/webview, which produced the following error:

# pkg-config --cflags  -- gtk+-3.0 webkit2gtk-4.0
Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-3.0' found
Package webkit2gtk-4.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `webkit2gtk-4.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'webkit2gtk-4.0' found
pkg-config: exit status 1

From there, I figured that I needed to install webkit2gtk-4.0 (and gtk 3) to get that to install.
Unfortunately, when I searched for webkit libraries, the best nixos's package manager could find for me was webkitgtk-2.4.11 (nixos.webkitgtk24x-gtk3), which has been marked as "insecure". At which point I gave up.

I'm not requesting assistance, I'm just following up like I said I would. I think I have an unusual OS situation, but maybe enumerating all dependencies in the readme might help people whose OSs are better suited towards actually installing those libraries.
Feel free to close this issue, as it doesn't present a problem that you can reasonably take action against.

Wasi compile version?

Was wondering if it's possible to compile this project with support for wasi for things like file io?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.