Coder Social home page Coder Social logo

Comments (5)

seanmonstar avatar seanmonstar commented on May 4, 2024

Yea, it was written with the new Rust 2018 macro syntax. It's currently fixed on master.

from warp.

seanmonstar avatar seanmonstar commented on May 4, 2024

With the publish of 0.1.1, the shown example should now be correct.

from warp.

Ran4 avatar Ran4 commented on May 4, 2024

The example code does not seem to work anymore, on Rust 1.39.0

Code (retrieved from https://crates.io/crates/warp)

// src/main.rs
use warp::{self, path, Filter};

fn main() {
    // GET /hello/warp => 200 OK with body "Hello, warp!"
    let hello = path!("hello" / String)
        .map(|name| format!("Hello, {}!", name));

    warp::serve(hello)
        .run(([127, 0, 0, 1], 3030));
}

Error(s)

$ cargo run
   Compiling warpexample v0.1.0 (/home/ran/src/rust/warp/warpexample)
warning: unused implementer of `core::future::future::Future` that must be used
 --> src/main.rs:6:5
  |
6 |     warp::serve(hello).run(([127, 0, 0, 1], 3030));
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_must_use)]` on by default
  = note: futures do nothing unless you `.await` or poll them

    Finished dev [unoptimized + debuginfo] target(s) in 8.42s
     Running `target/debug/warpexample`
                

Version

rustc 1.39.0 (4560ea788 2019-11-04)

Cargo dependencies

edition = "2018"

[dependencies]
warp = "0.2.0"

from warp.

jxs avatar jxs commented on May 4, 2024

Hi, yeah crates.io uses the repo README.md as the frontpage for the crate, and the example was only updated on #384 after the release of 0.2.0, you can use the README.md example

from warp.

Ran4 avatar Ran4 commented on May 4, 2024

The crates.io example should probably include tokio dependencies too.

from warp.

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.