Giter Site home page Giter Site logo

Comments (9)

theronic avatar theronic commented on May 21, 2024 4

I can't get rust_codegen plugin working either, even on nightly rust. I get "Package myproject does not have these features: nightly"

from rust-embed.

web3dopamine avatar web3dopamine commented on May 21, 2024 3

@Oni-zerone

  1. in Cargo.toml
    [dependencies]
    rocket = "0.4.4"
    rocket_codegen = "0.4.4"

  2. main.rs

#![feature(proc_macro_hygiene, decl_macro)]

#[macro_use] extern crate rocket;

#[get("/<name>/<age>")]
fn hello(name: String, age: u8) -> String {
    format!("Hello, {} year old named {}!", age, name)
}

fn main() {
    rocket::ignite()
        .mount("/hello", routes![hello])
        .launch();
}

check the first two lines; its different for rocket v0.3 and v0.4

it should work now... :)

from rust-embed.

Oni-zerone avatar Oni-zerone commented on May 21, 2024 1

@Mcat12 I had the same problem, and I think @rsdomingues is refering to this tutorial https://medium.com/sean3z/building-a-restful-crud-api-with-rust-1867308352d8
that is the first result on google searching for rust rest api.
Do you have a better documentation to share with us?

from rust-embed.

pyrossh avatar pyrossh commented on May 21, 2024

What version of rust are you using? The rocket example only works on the nightly version.
You need to run this specifically
cargo +nightly run --example rocket --features nightly

from rust-embed.

Boscop avatar Boscop commented on May 21, 2024

Ah, I had nightly but I didn't have --features nightly..
Now it works (but crashes when run from examples folder (issue 34)).

from rust-embed.

rsdomingues avatar rsdomingues commented on May 21, 2024

i've got the same error here.

cargo +nightly run --example rocket --features nightly

error: Package hero-api v0.1.0 (/Users/rodrigosd/git/rust/hero-api) does not have these features: nightly

if i try only cargo run

error: dlsym(0x7fa7b74156b0, rustc_plugin_registrar_e7907f37b0dc50ddf9d71b111db3523f): symbol not found
--> src/main.rs:5:11
|
5 | #![plugin(rocket_codegen)]
| ^^^^^^^^^^^^^^

error: aborting due to previous error

from rust-embed.

AzureMarker avatar AzureMarker commented on May 21, 2024

@rsdomingues Are you executing that in this library or your own? What is hero-api?

from rust-embed.

AzureMarker avatar AzureMarker commented on May 21, 2024

What is the goal that you/they are trying to accomplish? It doesn't make sense to try to run another crate's examples from your own project. You need to be in the rust-embed crate to run rust-embed examples.

from rust-embed.

AkhilSharma90 avatar AkhilSharma90 commented on May 21, 2024

@web3dopamine your solution works thanks. I wish they stuck with the old syntax (pre v0.3) for the first two lines. that made more sense

from rust-embed.

Related Issues (20)

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.