Peterlog

  1. When Ferrous Metals Corrode, pt. XVIII

    Intro

    This post summarizes chapter 19, "Concurrency". The concurrency chapter introduces has this nice bit at the beginning: "Experience inculcates a healthy skepticism, if not outright cynicism, toward all multithreaded code". Yes, yes it does.

    All the safety features Rust brings with it should come to good use here.

    Fork-Join …

  2. When Ferrous Metals Corrode, pt. XVII

    Intro

    This post summarizes chapter 18, "Input and Output"

    Rust I/O is organized around three basic traits: Read, BufRead, and Write. Read does byte-oriented input, BufRead buffered reads (lines of text and similar), Write does output.

    Example Read types are Stdin, File, TcpStream; BufRead: Cursor and StdinLock. Examples for …

  3. When Ferrous Metals Corrode, pt. XV

    Intro

    This post deals with standard library collections, and corresponds to chapter 16. in the Programming Rust book.

    Rust moves elements into collections to avoid deep-copying of values. Due to Rusts borrow checker we won't get dangling pointers while collections are changed or resized.

    Vec<T>

    We've used that one …

  4. When Ferrous Metals Corrode, pt. XIV

    Intro

    I'm working through chapter 15, "Iterators" in the Programming Rust book for this post.

    Iterators produce sequences of values, and all kinds of things can be iterated over – strings, collection types, files, connections, database records, etc.

    Rust iterators have a rich set of methods like fold(), map(), filter(), reduce …

  5. When Ferrous Metals Corrode, pt. XIII

    Intro

    For this post I'm looking at Chapter 14. Closures in the Rust Programming Book. A whole chapter dedicated to closures, count me in!

    Capturing Variables

    Rust closures can capture vars from the enclosing scope, as in other languages.

    Closures That Borrow

    By default closures borrow refs to captured vars …

  6. When Ferrous Metals Corrode, pt. XII

    Intro

    For this post I'm looking at Chapter 13. Utility Traits in the Programming Rust book.

    I don't expect radically new stuff here – but, given the importance of traits, rather some practical things into how idiomatic Rust should look like.

    The book defines three broad categories of utility traits:

    Language …
  7. When Ferrous Metals Corrode, pt. X

    Intro

    This post corresponds to Chapter 11. Traits and Generics.

    Traits are like interfaces or abstract base classes – contracts that describe what a type can do by describing it's methods. Optionally, they can also define default implementations of the methods they prescribe.

    An example trait:

    trait Write {
        fn write(&mut …

Page 1 / 9 »