Coder Social home page Coder Social logo

examples's People

Contributors

dependabot[bot] avatar horki avatar jimblandy 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  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

examples's Issues

Doesn't work with rustc 1.40

Hello, for iron-gcd, the crate urlencoded has the version 0.5.0 which is not compatible with rustc 1.40. But iron-gcd can be compiled with the urlencoded crate in the version v0.6.0.

image

License not obvious

I don't see any license information for this code anywhere. Maybe I'm just missing it?

Typo in page 317

I found a small typo in this code, page 317 :

impl<K,V> Hashmap<K,V> where K: Eq + Hash {
  fn get<Q: ?Sized>(&self,key: &Q) -> Option<&V>
  Where K:Borrow<Q>,
  Q: Eq+Hash
  {...}
}

The problem is in Where K: Borrow<Q> it should be Where key: Borrow<Q>
Instead of K it should be key.

Serving Pages to the Web in CH2 - 2nd ed

Running the code around page 18 gives me the following error:

error[E0277]: cannot subtract `chrono::Duration` from `Tm`
cookie.set_expires(time::now() - Duration::days(365));
| ^ no implementation for `Tm - chrono::Duration`
|
= help: the trait `Sub<chrono::Duration>` is not implemented for `Tm`
= help: the following other types implement trait `Sub<Rhs>`:
<Tm as Sub<time::Duration>>
<Tm as Sub>

The compiler doesn't even reach my code, so it must be an issue with dependencies.
Based on this Reddit post, other people are getting the same error:
https://www.reddit.com/r/rust/comments/17djgjd/working_through_programming_rust_2nd_edition_got/

Adding this dependency fixes the issue:
chrono = { version = "= 0.4.29" }

I think I find a error from page 520.

the code from P.520:

$( fields.insert($crate::ToString::to_string($key), json!($value)); )*

the code in this repository is:

$( fields.insert($crate::macros::ToString::to_string($key), json!($value)); )*

It should use the second version $crate::macros::ToString because ToString is private, just like HashMap?

๐Ÿ˜„

iron-gdc error

Hello, I'm having a compiler problem, running on windows 10 with C++ build tools 2017.
Book's Pages: 18-19.

Terminal Output:

$ cargo run
Compiling iron-gdc v0.1.0 (file:///C:/Users/Simone%20Romano/Desktop/git/rust/iron-gdc)
error: cannot find macro mime! in this scope
--> src\main.rs:21:22
|
21 | response.set_mut(mime!(Text/Html; Charset=Utf8));
| ^^^^

error: aborting due to previous error

error: Could not compile iron-gdc.

To learn more, run the command again with --verbose.

Code:

extern crate iron;
#[macro_use] extern crate mime;

use iron::prelude::*;
use iron::status;

fn main() 
{
    let port = 3000;
    let hostname = "localhost:" + port.to_string();
    println!("Serving on http://{}...", hostname);

    Iron::new(get_form).http(hostname).unwrap;
}

fn get_form(_request: &mut Request) -> IronResult<Response>
{
    let mut response = Response::new();

    response.set_mut(status::Ok);
    response.set_mut(mime!(Text/Html; Charset=Utf8));
    response.set_mut(r#"
        <title> GDC Calculator </title>
        <form action="/gdc" method="post">
            <input type="text" name="n">
            <input type="text" name="n">
            <button type="submit"> Compute GDC </button>
        </form>
    "#);

    Ok(response)
}

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.