GithubHelp home page GithubHelp logo

jsoverson / node-to-rust Goto Github PK

View Code? Open in Web Editor NEW
1.4K 15.0 71.0 54.68 MB

License: Other

Rust 91.26% JavaScript 1.68% TypeScript 5.10% Makefile 1.63% Handlebars 0.19% Ruby 0.14%
ebook nodejs rust tutorial

node-to-rust's Issues

Day 20: CLI Arguments and Logging, a issue with the chapter

As mentioned in the section on Adding CLI Arguments

  • follow the steps and you will see the following output on the command line
cargo run -p cli -- --help
wasm-runner 0.1.0
Sample project from https://vino.dev/blog/node-to-rust-day-1-rustup/

USAGE:
    cli

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information
The example code at this point should look like this
  use my_lib::Module;
  use structopt::{clap::AppSettings, StructOpt};

  #[macro_use]
  extern crate log;

  #[derive(StructOpt)]
  #[structopt(
      name = "wasm-runner",
      about = "Sample project from https://vino.dev/blog/node-to-rust-day-1-rustup/",
      global_settings(&[
          AppSettings::ColoredHelp
      ]),
  )]
  struct CliOptions {}

  fn main() {
      env_logger::init();
      debug!("Initialized logger");

      match Module::from_file("./module.wasm") {
          Ok(_) => {
              info!("Module loaded");
          }
          Err(e) => {
              error!("Module failed to load: {}", e);
          }
      }
  }

Now when we run our cli we see… nothing at all.

No issue.

I just want to thank you for your series mate !
Great read, keep it up.
🥇

I'm getting error

Hi, this error will be easy for ruby developers but I'm not a ruby developer and I can't solve it although investigating in google. That's the error:

$ make deps
bundle install
/opt/homebrew/opt/ruby/bin/bundle:25:in `load': cannot load such file -- /opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/bundler-2.5.7/exe/bundle (LoadError)
	from /opt/homebrew/opt/ruby/bin/bundle:25:in `<main>'
make: *** [deps] Error 1

How can I solve that? Thanks.

Day 9: getState() return type differences

When describing the solution for getState, initially the implementation pub fn get_state(&self) -> &String is given along with a usefull explanation which matches the struct types.

But for the "full code" implementation immediately following, it changes to pub fn get_state(&self) -> &str which I found confusing since the distinction between them is not covered and the apparent String -> &str "cohersion" in the second version is not made clear inline.

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.