Complete code for the larger example programs from the book.

Overview

Code Examples for Programming Rust

This repository contains complete code for the larger example programs from the book “Programming Rust”, by Jim Blandy, Jason Orendorff, and Leonora Tindall.

Each subdirectory is a distinct Rust project, with its own Cargo.toml file. You should be able to enter each directory and use cargo build and cargo test. For those projects that define programs, cargo run should run them.

The example code in this directory and its subdirectories is licensed under the terms of the MIT license. See LICENSE-MIT for details.

Chapter 2: A Tour of Rust

  • The gcd directory holds the command-line program for computing the greatest common denominator of a list of numbers.

  • The actix-gcd directory holds the code for the simple web service, implemented using the actix-web framework, that computes greatest common denominators.

  • The Mandelbrot plotting program has its own repository, at https://github.com/ProgrammingRust/mandelbrot. This repository contains several branches, each showing a different implementation strategy. The single-threaded branch holds the code for the single-threaded version, and the bands branch holds the multi-threaded version. Chapter 19, “Concurrency”, shows several other approaches, which appear on other branches; see the repository's README.md file for details.

Chapter 8: Crates and Modules

  • We did not actually write a fern simulator. Please accept our sincere apology for this feckless deception. But the skeleton of modules and definitions we show in the book is in the fern_sim subdirectory.

Chapter 9: Structs

  • The queue directory holds a library that defines the Queue type, representing a queue of char values.

  • The generic-queue directory holds code for generic Queue type.

Chapter 10: Enums and Patterns

  • The binary-tree directory holds the source code for the BinaryTree type that appears in the “Generic Enums” and “Populating a Binary Tree” sections.

Chapter 12: Operator Overloading

  • The complex directory holds the Complex type used as a running example throughout the chapter.

  • The interval directory holds the Interval type for which the book implements the std::cmp::PartialOrd trait.

Chapter 14: Closures

  • The 'basic-router' directory holds the BasicRouter type used as an example in the “Callbacks” section.

Chapter 15: Iterators

  • The binary-tree directory holds the implementation of the Iterator trait for the BinaryTree type originally defined in the “Enums and Patterns” chapter.

Chapter 17: Strings and Text

  • The complex directory includes the implementation of the std::fmt::Display formatting trait for a complex number type, shown in the section “Formatting Your Own Types”.

Chapter 18: Input and Output

  • The grep directory holds the simple grep-like program shown in the section “Reading Lines”.

  • The copy directory holds the program for copying directory trees from the section “Reading Directories”, including the additions shown in the next section, “Platform-Specific Features”.

  • The echo-server directory holds the simple network service shown in the “Networking” section.

  • The http-get directory holds the command-line program that uses the reqwest crate to carry out an HTTP request.

Chapter 19: Concurrency

  • The search engine used as a running example throughout the book has its own repository, at https://github.com/ProgrammingRust/fingertips.

  • The Mandelbrot set plotter discussed in the section “Revisiting the Mandelbrot Set” also has its own repository, at https://github.com/ProgrammingRust/mandelbrot. The repository includes several branches exploring different implementations; see the repository's README.md file for details.

Chapter 20: Asynchronous Programming

  • The cheapo-request directory uses async-std's asynchronous networking functions and the block_on executor function to make a bare-bones HTTP request.

  • The many-requests directory makes several requests concurrently on a single thread, using async-std's spawn_local.

  • The many-requests-surf directory does the same using surf, an open-source asynchronous HTTP client library available from crates.io that does a much better job with HTTP than our chapter's cheapo_request function.

  • The spawn-blocking directory includes the definition of spawn_blocking presented in the section "Primitive Futures and Executors: When Is A Future Worth Polling Again?". The crate also includes some tests to exercise the function.

  • The block-on directory includes the implementation of a simple block_on executor, which demonstrates polling and waiting for wakers to be invoked.

  • The chat client and server used as an extended example are in their own repository, at https://github.com/ProgrammingRust/async-chat.

Chapter 21: Macros

  • The json-macro directory holds the definition of the json! macro built in the section “The json! Macro”.

Chapter 22: Unsafe Code

  • The ascii directory holds the Ascii type used as an example in the sections “Unsafe Blocks” and “Unsafe Functions”.

  • The ref-with-flag directory holds the RefWithFlag type from the “Raw Pointers” section.

  • The gap-buffer directory holds the GapBuffer type, used in the “Raw Pointers” section to illustrate pointer arithmetic and std::ptr::read and std::ptr::write.

Chapter 22: Foreign Functions

  • The libgit2-rs and libgit2-rs-safe directories contain the two versions of the program that uses Rust's foreign function interface to call functions from the libgit2 C library. The version in libgit2-rs is written as a single giant block of unsafe code, whereas the version in libgit2-rs-safe implements a safe Rust interface to the same functionality, using Rust's type system to enforce libgit2's rules for proper use of the library.

    Note that both of these require you to have a copy of libgit2 present on your system. The chapter provides detailed instructions for building the correct version, for Linux, macOS, and Microsoft Windows.

Comments
  • Doesn't work with rustc 1.40

    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

    opened by corebreaker 3
  • iron-gdc error

    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)
    }
    opened by simoneromano96 3
  • build(deps): bump regex from 1.5.4 to 1.5.6 in /actix-gcd

    build(deps): bump regex from 1.5.4 to 1.5.6 in /actix-gcd

    Bumps regex from 1.5.4 to 1.5.6.

    Changelog

    Sourced from regex's changelog.

    1.5.6 (2022-05-20)

    This release includes a few bug fixes, including a bug that produced incorrect matches when a non-greedy ? operator was used.

    1.5.5 (2022-03-08)

    This releases fixes a security bug in the regex compiler. This bug permits a vector for a denial-of-service attack in cases where the regex being compiled is untrusted. There are no known problems where the regex is itself trusted, including in cases of untrusted haystacks.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • build(deps): bump crossbeam-utils from 0.8.5 to 0.8.8 in /cheapo-request

    build(deps): bump crossbeam-utils from 0.8.5 to 0.8.8 in /cheapo-request

    Bumps crossbeam-utils from 0.8.5 to 0.8.8.

    Release notes

    Sourced from crossbeam-utils's releases.

    crossbeam-utils 0.8.8

    • Fix a bug when unstable loom support is enabled. (#787)

    crossbeam-utils 0.8.7

    • Add AtomicCell<{i*,u*}>::{fetch_max,fetch_min}. (#785)
    • Add AtomicCell<{i*,u*,bool}>::fetch_nand. (#785)
    • Fix unsoundness of AtomicCell<{i,u}64> arithmetics on 32-bit targets that support Atomic{I,U}64 (#781)

    crossbeam-utils 0.8.6

    • Re-add AtomicCell<{i,u}64>::{fetch_add,fetch_sub,fetch_and,fetch_or,fetch_xor} that were accidentally removed in 0.8.0 0.7.1 on targets that do not support Atomic{I,U}64. (#767)
    • Re-add AtomicCell<{i,u}128>::{fetch_add,fetch_sub,fetch_and,fetch_or,fetch_xor} that were accidentally removed in 0.8.0 0.7.1. (#767)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • build(deps): bump crossbeam-utils from 0.8.5 to 0.8.8 in /many-requests

    build(deps): bump crossbeam-utils from 0.8.5 to 0.8.8 in /many-requests

    Bumps crossbeam-utils from 0.8.5 to 0.8.8.

    Release notes

    Sourced from crossbeam-utils's releases.

    crossbeam-utils 0.8.8

    • Fix a bug when unstable loom support is enabled. (#787)

    crossbeam-utils 0.8.7

    • Add AtomicCell<{i*,u*}>::{fetch_max,fetch_min}. (#785)
    • Add AtomicCell<{i*,u*,bool}>::fetch_nand. (#785)
    • Fix unsoundness of AtomicCell<{i,u}64> arithmetics on 32-bit targets that support Atomic{I,U}64 (#781)

    crossbeam-utils 0.8.6

    • Re-add AtomicCell<{i,u}64>::{fetch_add,fetch_sub,fetch_and,fetch_or,fetch_xor} that were accidentally removed in 0.8.0 0.7.1 on targets that do not support Atomic{I,U}64. (#767)
    • Re-add AtomicCell<{i,u}128>::{fetch_add,fetch_sub,fetch_and,fetch_or,fetch_xor} that were accidentally removed in 0.8.0 0.7.1. (#767)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Typo in page 317

    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.

    opened by koptan 1
  • [Question] Why shutdown is required in cheapo-request example

    [Question] Why shutdown is required in cheapo-request example

    Hi, firstly very thanks for your awesome examples :-D

    I have a little question about this example: https://github.com/ProgrammingRust/examples/blob/master/cheapo-request/src/main.rs#L11

    Can you please tell me why this shutdown is required? I have uncomment this line, but it seems that I can never get response from server.

    opened by WindSoilder 1
  • ch21: libgit2-safe; replace deprecated const ONCE_INIT

    ch21: libgit2-safe; replace deprecated const ONCE_INIT

    @jimblandy use of std::sync::Once::new, due to warning

    warning: use of deprecated constant `std::sync::ONCE_INIT`: the `new` function is now preferred
      --> src/git/mod.rs:78:36
       |
    78 |     static ONCE: std::sync::Once = std::sync::ONCE_INIT;
       |                                    ^^^^^^^^^^^^^^^^^^^^ help: replace the use of the deprecated constant: `Once::new()`
    
    opened by Horki 1
  • doc: README.md:

    doc: README.md: "Foreign Functions" is chapter 23 (rather than 22)

    The heading: "Chapter 22: Foreign Functions" should be: "Chapter 23: Foreign Functions"

    In the first edition of the book, there is no "Foreign Functions" chapter.

    In the second edition of the book, "Foreign Functions" is chapter 23.

    opened by salewski 0
  • build(deps): bump crossbeam-utils from 0.8.5 to 0.8.9 in /cheapo-request

    build(deps): bump crossbeam-utils from 0.8.5 to 0.8.9 in /cheapo-request

    Bumps crossbeam-utils from 0.8.5 to 0.8.9.

    Release notes

    Sourced from crossbeam-utils's releases.

    crossbeam-utils 0.8.9

    • Replace lazy_static with once_cell. (#817)

    crossbeam-utils 0.8.8

    • Fix a bug when unstable loom support is enabled. (#787)

    crossbeam-utils 0.8.7

    • Add AtomicCell<{i*,u*}>::{fetch_max,fetch_min}. (#785)
    • Add AtomicCell<{i*,u*,bool}>::fetch_nand. (#785)
    • Fix unsoundness of AtomicCell<{i,u}64> arithmetics on 32-bit targets that support Atomic{I,U}64 (#781)

    crossbeam-utils 0.8.6

    • Re-add AtomicCell<{i,u}64>::{fetch_add,fetch_sub,fetch_and,fetch_or,fetch_xor} that were accidentally removed in 0.8.0 0.7.1 on targets that do not support Atomic{I,U}64. (#767)
    • Re-add AtomicCell<{i,u}128>::{fetch_add,fetch_sub,fetch_and,fetch_or,fetch_xor} that were accidentally removed in 0.8.0 0.7.1. (#767)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • build(deps): bump crossbeam-utils from 0.8.5 to 0.8.9 in /many-requests

    build(deps): bump crossbeam-utils from 0.8.5 to 0.8.9 in /many-requests

    Bumps crossbeam-utils from 0.8.5 to 0.8.9.

    Release notes

    Sourced from crossbeam-utils's releases.

    crossbeam-utils 0.8.9

    • Replace lazy_static with once_cell. (#817)

    crossbeam-utils 0.8.8

    • Fix a bug when unstable loom support is enabled. (#787)

    crossbeam-utils 0.8.7

    • Add AtomicCell<{i*,u*}>::{fetch_max,fetch_min}. (#785)
    • Add AtomicCell<{i*,u*,bool}>::fetch_nand. (#785)
    • Fix unsoundness of AtomicCell<{i,u}64> arithmetics on 32-bit targets that support Atomic{I,U}64 (#781)

    crossbeam-utils 0.8.6

    • Re-add AtomicCell<{i,u}64>::{fetch_add,fetch_sub,fetch_and,fetch_or,fetch_xor} that were accidentally removed in 0.8.0 0.7.1 on targets that do not support Atomic{I,U}64. (#767)
    • Re-add AtomicCell<{i,u}128>::{fetch_add,fetch_sub,fetch_and,fetch_or,fetch_xor} that were accidentally removed in 0.8.0 0.7.1. (#767)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • build(deps): bump hyper from 0.14.9 to 0.14.19 in /http-get

    build(deps): bump hyper from 0.14.9 to 0.14.19 in /http-get

    Bumps hyper from 0.14.9 to 0.14.19.

    Release notes

    Sourced from hyper's releases.

    v0.14.19

    Bug Fixes

    • http1: fix preserving header case without enabling ffi (#2820) (6a35c175)
    • server: don't add implicit content-length to HEAD responses (#2836) (67b73138)

    Features

    Breaking Changes

    • ffi (unstable):
      • hyper_clientconn_options_new no longer sets the http1_preserve_header_case connection option by default. Users should now call hyper_clientconn_options_set_preserve_header_case if they desire that functionality. (78de8914)

    New Contributors ❤️

    v0.14.18

    Bug Fixes

    • ffi: don't build C libraries by default (1c663706)

    Features

    • client: add HttpInfo::local_addr() method (055b4e7e, closes #2767)

    New Contributors

    v0.14.17

    Bug Fixes

    ... (truncated)

    Changelog

    Sourced from hyper's changelog.

    v0.14.19 (2022-05-27)

    Bug Fixes

    • http1: fix preserving header case without enabling ffi (#2820) (6a35c175)
    • server: don't add implicit content-length to HEAD responses (#2836) (67b73138)

    Features

    Breaking Changes

    • ffi (unstable):
      • hyper_clientconn_options_new no longer sets the http1_preserve_header_case connection option by default. Users should now call hyper_clientconn_options_set_preserve_header_case if they desire that functionality. (78de8914)

    v0.14.18 (2022-03-22)

    Bug Fixes

    • ffi: don't build C libraries by default (1c663706)

    Features

    • client: add HttpInfo::local_addr() method (055b4e7e, closes #2767)

    v0.14.17 (2022-02-10)

    Bug Fixes

    Features

    ... (truncated)

    Commits
    • f8e2a83 v0.14.19
    • a929df8 docs(various): fix typos in VISION and ROADMAP (#2875)
    • 3a755a6 chore(lib): update tokio-util to 0.7 (#2762)
    • 4678be9 docs(contrib): add guide for Triaging Issues
    • 775fac1 docs(lib): propose 1.0 roadmap (#2806)
    • a32658c feat(server): add Connection::http2_max_header_list_size option (#2828)
    • 67b7313 fix(server): don't add implicit content-length to HEAD responses (#2836)
    • faf24c6 refactor(http1): assorted code readability improvements in h1/conn.rs (#2817)
    • 6a35c17 fix(http1): fix preserving header case without enabling ffi (#2820)
    • 89598df docs(lib): fix some typos (#2818)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • build(deps): bump tokio from 1.6.1 to 1.16.1 in /http-get

    build(deps): bump tokio from 1.6.1 to 1.16.1 in /http-get

    Bumps tokio from 1.6.1 to 1.16.1.

    Release notes

    Sourced from tokio's releases.

    Tokio v1.16.1

    1.16.1 (January 28, 2022)

    This release fixes a bug in #4428 with the change #4437.

    #4428: tokio-rs/tokio#4428 #4437: tokio-rs/tokio#4437

    Tokio v1.16.0

    Fixes a soundness bug in io::Take (#4428). The unsoundness is exposed when leaking memory in the given AsyncRead implementation and then overwriting the supplied buffer:

    impl AsyncRead for Buggy {
        fn poll_read(
            self: Pin<&mut Self>,
            cx: &mut Context<'_>,
            buf: &mut ReadBuf<'_>
        ) -> Poll<Result<()>> {
          let new_buf = vec![0; 5].leak();
          *buf = ReadBuf::new(new_buf);
          buf.put_slice(b"hello");
          Poll::Ready(Ok(()))
        }
    }
    

    Also, this release includes improvements to the multi-threaded scheduler that can increase throughput by up to 20% in some cases (#4383).

    Fixed

    • io: soundness don't expose uninitialized memory when using io::Take in edge case (#4428)
    • fs: ensure File::write results in a write syscall when the runtime shuts down (#4316)
    • process: drop pipe after child exits in wait_with_output (#4315)
    • rt: improve error message when spawning a thread fails (#4398)
    • rt: reduce false-positive thread wakups in the multi-threaded scheduler (#4383)
    • sync: don't inherit Send from parking_lot::*Guard (#4359)

    Added

    • net: TcpSocket::linger() and set_linger() (#4324)
    • net: impl UnwindSafe for socket types (#4384)
    • rt: impl UnwindSafe for JoinHandle (#4418)
    • sync: watch::Receiver::has_changed() (#4342)
    • sync: oneshot::Receiver::blocking_recv() (#4334)
    • sync: RwLock blocking operations (#4425)

    Unstable

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Owner
Programming Rust
Code examples for the book Programming Rust, from O'Reilly
Programming Rust
Code to follow along the "Zero To Production" book on API development in Rust.

Zero To Production / Code (Chapter 10 - Part 1) Zero To Production In Rust is an opinionated introduction to backend development using Rust. This repo

Luca Palmieri 2.8k Dec 31, 2022
Rust crate to implement a counterpart to the PBRT book's (3rd edition) C++ code.

Rust crate to implement a counterpart to the PBRT book's (3rd edition) C++ code.

Jan Walter 763 Dec 27, 2022
A turing-complete programming language using only zero-width unicode characters, inspired by brainfuck and whitespace.

Zero-Width A turing-complete programming language using only zero-width unicode characters, inspired by brainfuck and whitespace. Currently a (possibl

Gavin M 2 Jan 14, 2022
Complete bindings to the raspicam C++ library

raspicam-rs Rust bindings to the amazing C++ raspicam library (with optional OpenCV utilities)! This is a followup to a Rust-based robotics project I

blusk 8 Oct 17, 2022
This repository contains the source of "The Rust Programming Language" book.

The Rust Programming Language This repository contains the source of "The Rust Programming Language" book. The book is available in dead-tree form fro

The Rust Programming Language 11.2k Jan 8, 2023
A library for extracting #[no_mangle] pub extern "C" functions (https://docs.rust-embedded.org/book/interoperability/rust-with-c.html#no_mangle)

A library for extracting #[no_mangle] pub extern "C" functions In order to expose a function with C binary interface for interoperability with other p

Dmitrii - Demenev 0 Feb 17, 2022
clone of grep cli written in Rust. From Chapter 12 of the Rust Programming Language book

minigrep is a clone of the grep cli in rust Minigrep will find a query string in a file. To test it out, clone the project and run cargo run body poem

Raunak Singh 1 Dec 14, 2021
The ray tracer challenge in rust - Repository to follow my development of "The Raytracer Challenge" book by Jamis Buck in the language Rust

The Ray Tracer Challenge This repository contains all the code written, while step by implementing Ray Tracer, based on the book "The Ray Tracer Chall

Jakob Westhoff 54 Dec 25, 2022
Book - Actix user guides

User guides Actix User Guide Actix API Documentation (Development) Actix API Documentation (Releases) Actix Web User Guide Actix Web API Documentation

Actix 185 Dec 25, 2022
High Assurance Rust - A free book about developing secure and robust systems software.

High Assurance Rust - A free book about developing secure and robust systems software.

Tiemoko Ballo 1.1k Jan 9, 2023
Learn programming with Rust as a first language (book)

Learn programming with Rust as first language This is a book to learn programming from scratch. Read the book here: https://deavid.github.io/lprfl/ LI

David Martínez Martí 2 May 21, 2022
Majestic Lisp book and implementation, in Brazillian Portuguese.

Majestic Lisp Criado e desenvolvido por Lucas S. Vieira <lucasvieira at protonmail dot com>. Seja bem-vindo(a) a Majestic Lisp, um dialeto de Lisp cuj

Lucas Vieira 3 Oct 26, 2022
Search and read 'The Rust Book' from the terminal

TheBook TheBook is a command line utility that allows you to SEARCH and READ The Rust Programming Language (popularly known as 'The Book' ) from the t

0xHiro 技術者 239 Jan 4, 2023
Generate SUMMARY.md files based on your book's file structure

mdbook-autosummary Generate a SUMMARY.md for your mdBook based on your folder structure! Warning The implementation is hacky and has several limitatio

Hyper 3 Sep 30, 2023
A minimal version of 'grep' implemented in Rust. Exercise in the "The Rust Programming Language" book.

Minigrep - A simple grep-like tool implemented in Rust This simple CLI tool searches for a given pattern in a specified file and as a result, it print

Filip Szutkowski 3 Mar 15, 2024
Visualization for Timely Dataflow and Differential Dataflow programs

DDShow Visualization for Timely Dataflow and Differential Dataflow programs Getting started with ddshow First, install ddshow via cargo. As of now dds

Chase Wilson 61 Nov 25, 2022
🕶 Assorted checks and validations for writing safer Solana programs.

vipers ?? Assorted checks and validations for writing safer Solana programs. Motivation Solana's fee mechanism is unlike Ethereum's, in that the numbe

Saber 131 Sep 14, 2022
Rust programs written entirely in Rust

mustang Programs written entirely in Rust Mustang is a system for building programs built entirely in Rust, meaning they do not depend on any part of

Dan Gohman 561 Dec 26, 2022
Cogo is a high-performance library for programming stackful coroutines with which you can easily develop and maintain massive concurrent programs.

Cogo is a high-performance library for programming stackful coroutines with which you can easily develop and maintain massive concurrent programs.

co-rs 47 Nov 17, 2022