The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Thanks for reporting this.

I don't actually do any of the typesetting myself, but I will see if I can get this fixed. The Manning team is quite responsive
That's a great find. Thank for pointing it out and sorry that it's there! I will update the listing and it will be corrected when the MEAP is updated smilie
Welcome to the August/September 2018 progress report for Rust in Action, a book on the Rust programming language for intermediate programmers that teaches Rust via systems programming examples.

To start with, some good news. 2 chapters have been released since my last progress report! The early access book is over 200 pages long already, so it's a great time to buy. You can feel safe that you'll learn something and you still have plenty of opportunity to contribute if you're so inclined.

About the newly released chapters

Chapter 11 - Time and Timers takes readers through the process of creating a fully-fledged NTP client that can update the system's time. It starts by walking through how quartz crystals keep your computer moving and works its way through several practical examples. Oh and it also describes how Google delals with leap seconds. You'll learn that Google's treatment is different from almost everyone else in the world.

Chapter 12 - Exceptions, Signals, Interrupts is really great. We start by exploring what the difference between several related terms such as traps/signals/exceptions/interupts are. The body of the chapter walks readers through UNIX signals and the use of signal handlers as a model for exception handling more generally. The chapter also discusses how to access LLVM's "intrinsic functions", which unlock code that allows you to jump around the stack through functions. It's kinda neat!


So... what's up?

Depression & anxiety came back to my life. The book's progress suffered. I've had a good rest and things are progressing well again.

Now for some more difficult news. At the risk of oversharing, the last 12 weeks or so have been especially difficult for me:

• relationship pressure - for the book, I've tried to spend 8-11pm 4x/week. That's meant my partner and I have had very little kid-free time together, and I have been unable to contribute around the house as much as I usually would. This has led to some frustration and tension, which we have been working through.
• family pressure - I've got 2 kids under three years of age and they've both been really sick all winter. We are hoping the upcoming spring and summer will bring some relief!
• work pressure - I've been feeling increasingly disengaged at work over the last 12months or so, which led to a period of me investigating options for myself to work overseas before my kids reach school. During August, I had around 20 interviews, most of which were 5-6am or 10-11pm due to time zone realities. The process was exhausting and didn't eventuate into a suitable offer.
• financial pressure - we discovered earlier this year that one of our house foundations was unstable.. a leaky pipe had been undermining it. The unexpected repairs ran into five figures.
• performance pressure - my personal aim for writing a book was to produce the best technical book of its generation. I have been noticing a trend downward in quality as publication volumes increased. I want to write a book that people will refer to for 2 decades or more. That kind of goal is extremely debilitating.
• illness - I too haven't escaped getting sick. Seasonal influenza struck me down for about 2 weeks during the period.

The environment for all of this has been consistently poor weather (thanks, winter) and a backdrop of depression/anxiety. The Rust community is amazing. But I am faced with crippling impostor syndrome. Normally I can allow those types of thoughts to simply fade away.

But in August, I had panic attacks for the first time since I was at university (about 15 years ago).

When that happened, I realised that I really needed to put the book down and rest as much as I could.

That rest has happened and now everything feels much lighter.

So I do apologize that I haven't been as fast as I would have liked in completing the book. It will happen - I just need to be a little more patient with myself. Otherwise I risk loosing my relationship, my kids and my livelihood.



Why Rust in Action? Should you buy the book?

Yes. The book is very good and has received near-universal praise.

If you're interested in learning Rust--especially if you have been told something like "you need to know C/C++ before you can really understand Rust"--then probably! In many ways, Rust in Action is intended as the next book that you read after the introductory materials.

A secondary goal is to really demystify the term "systems programming". It's not magical. You are perfectly capable of understanding how a file system operates and how memory works. Rust in Action is actually unique from the point of view of systems programming books too - as almost every example works on Windows!

The book tries to teach you everything that seems to be assumed by the more advanced blog posts that the community tends to generate. Its not finished, but it is in a good shape to do that already. Here are a few interesting projects that have already been implemented:

- a CPU emulator
- a fully functional NTP client
- a skeleton grep implementation
- a fixed-point decimal implementation
- a memory scanner so you can learn how game cheaters cheat

Connect with the author

You are very welcome to reach me at any stage! The easiest method for me is Twitter, but I am also active on LinkedIn, the Rust subreddit and the Rust users forum. Oh and other places too like Stack Overflow and Quora. I tend to stay off synchronous channels such as IRC as I'm based in a strange time zone (UTC+12).
Welcome to the July 2018 progress report for Rust in Action, a book on the Rust programming language for intermediate programmers that teaches Rust via systems programming examples. It's actually unique from the point of view of systems programming books too - as almost every example works on Windows!

Just over 200 pages are available via Manning's Early Access Program (MEAP). If you don't own the book and would like to preview its contents for free, visit the book's liveBook page. To get there, visit the book's webpage and click "Look inside". If you would like to buy it, Manning has just added a feature called tokens that allows you to purchase one chapter at a time. Oh and if you would like a big discount, use the coupon code slmcnamara at the checkout.

Dear readers: a new chapter will be with you very very shortly! I received a copy of the updated MEAP from the publisher a few days ago, and now it's in their task queue to send out.

Here are some other notes on the book's progress over the month:


Table of Contents Re-factoring

The big discussion with the publisher was a resolution with what to do with the table of contents:

Chapter 7 - Files & File Systems has been split into three: Chapter 7 - Files & File Systems, Chapter 8 - Hashing, Chapter 9 - Trees. Chapter 7 has been growing to nearly 100 pages. Splitting these apart gives each topic space to breath. Don't worry if those new topic headings seem too academic, the chapters will still be very practical!

Part 4 has shrunk. After some feedback from the community, I've realized that single chapters is insufficient space for my "C Extensions in Rust" and "Beyond the Server" (compiling to WASM/micro-controllers) ideas. Instead, I plan to write stand-alone online tutorials on those topics once the book has been released. I hope you understand the reasoning behind this change.


Book Progress

Chapter 11 9 - Time and Timers is about to be released via the MEAP program. It takes readers through the process of creating a fully-fledged NTP client that can update the system's time. Oh and describing how Google does with leap seconds and how that differs from almost everyone else in the world.

Chapter 12 10 - Exceptions, Signals, Interrupts is nearly completed. After some comments from the editor and some reflection, I've decided to add some new content. he chapter will work up to explaining how exceptions can be implemented in a programming language, via teaching readers how to access LLVM's "intrinsics".

The chapter's main focus is to discuss a few gritty details about how hardware, such as the network controller, tells the CPU that there is data ready. That content is done.

Chapter 8 - Networking is in the final planning stages, but I'll wait until the 4 in-progress chapters are finished before writing any content.


Should you buy the book?

If you're interested in learning Rust--especially if you have been told something like "you need to know C/C++ before you can really understand Rust"--then probably! In many ways, Rust in Action is intended as the next book that you read after the introductory materials.

The book tries to teach you everything that seems to be assumed by the more advanced blog posts that the community tends to generate. Its only half way there, but it is in a good shape to do that already. It already has a few interesting projects:

- a CPU emulator
- a fully functional NTP client
- a skeleton grep implementation
- a fixed-point decimal implementation
- a memory scanner so you can learn how game cheaters cheat

Connect with the author

You are very welcome to reach me at any stage! The easiest method for me is Twitter, but I am also active on LinkedIn, the Rust subreddit and the Rust discourse forum. Oh and other places too like Stack Overflow and Quora. I tend to stay of channels such as IRC as I'm based in a strange time zone (UTC+12).





247493 wrote:I'm enjoying the book and I'm learning a lot also, but I'm bit disappointed because in the section "Working with the operating system to scan an address space" the example is based on Windows. I think that an example using Linux will give more value to the book.


Jorge - this makes a lot of sense. I prefer working with Linux anyway. When writing the chapter, I was under some pressure to get the content released. So now that time is less critical for chapter 5, I will try to include it.

Thanks for your question. It's very helpful to know what readers are interested in!
Welcome to the latest progress report for Rust in Action, a book on the Rust programming language for intermediate programmers that teaches Rust via systems programming.

Several chapters are already currently available via Manning's Early Access Program (MEAP). If you don't own the book and would like to preview its contents for free, visit the book's liveBook page. To get there, visit the book's webpage and click "Look inside".

Book Progress

Chapter 10 - Exceptions, Signals, Interrupts is written and submitted to the editor. I'm excited (nervous?) to hear reader feedback on this one. It's one of the few UNIX-only examples so far. I've used signals in all of the examples, as the programming model is very similar to adding interrupt handlers to the kernel. Although it's possible to implement userspace interrupt handlers, I decided against adding significantly more complexity. If you would like the chapter to dive deeper, please let me know in the forums when it comes out.

Chapter 9 - Time and Timers is written and submitted to the editor. It takes readers through the process of creating a fully-fledged NTP client that can update the system's time. Oh and describing how Google does with leap seconds and how that differs from almost everyone else in the world.

Chapter 8 - Networking is in the final planning stages. I have been considering the feasibility of implementing a proxy for the PostgreSQL on-wire format. Does this sound interesting? Let me know!

Chapter 7 - Files & File Systems is still awaiting its final refactoring. The chapter is quite large (nearly 80 pages) and there have been internal discussions about splitting into two or three smaller chapters. The chapter takes readers through the process of building several key/value stores and discusses how hashing and B-Trees operate.


Check out some code

If you would like to do some pre-reading, I've made one of the code projects available for review here: https://git.nzoss.org.nz/tim-mcnamara/timepong. I'm hoping that this project will outlive the book! If you have Rust installed, you should be able to keep your system's time in sync right away!


Should you buy the book?

If you're interested in learning Rust, then probably! In many ways, Rust in Action is intended as the next book that you read. It tries to teach you everything that seems to be assumed by the more advanced blog posts that the community tends to generate.

The book already has a few interesting projects:

- a CPU emulator
- a fully functional NTP client
- a skeleton grep implementation
- worked examples of strategies for working with the borrow checker when you're still learning Rust

More importantly - there is lots of social proof. Multiple readers have said that it's the best book they've ever read and the book's code examples even have a fan page.
19705 wrote:Coincidentally my 'learning rust' project has been a key value store with b-tree indexes. It will be really interesting to compare our solutions. I suspect yours will be a lot more elegant!
Lol - possibly, although unlikely! Its lack of elegance is actually partially to blame for the delay.

I took the unwise choice to try to explain how to create an on-disk b-tree on top of an append-only key/value store. This is actually the on-disk architecture of the CouchDB database and the primary reason why data corruption is impossible within CouchDB. Why is that unwise? Well, to explain everything the chapter needs to explain a) key/value stores, b) secondary storage (e.g. spinning disks introduce delays), c) b-trees, d) CRC checks, e) ...

I'm hoping that the material will actually be seen by the readership as very impressive. But the editorial team are rightly concerned that it is far too much material to pack into a single chapter.


19705 wrote:I hope this means that chapter 8 will be covering Tokio? I've tried to learn it using the official documentation and it has left me completely befuddled! Really looking forward to that.
I hope to, but to be honest I'm still somewhat undecided. If I'm perfectly honest, I'm feeling a little exhausted and would prefer an easier task! The last year has been quite a mental battle. Most evenings from 8-11pm have been stuck in front of the computer.

In the table of contents submitted to the editors, I intended to explain networking by either implementing a proxy for the Postgres on-wire protocol that measures queries/minute. tokio would be a very good choice for that kind of system.

I have had some readers ask if I could do something lower-level though. Another part of me would like to explain layer 4 protocols (e.g. UDP and TCP) by implementing something else on top of IP.

At this stage, I only have sketches of designs. Happy to hear more thoughts..
Stephen! So sorry for the two week delay to respond. I didn't have time to reply saw the notification of your message and subsequently got sidetracked.

srepho wrote:Firstly let me say that I think the book is fantastic so far and I am really enjoying it. I had halfheartedly started Rust a few times before, but your book is helping me develop a more solid grounding. I also really appreciate your updates on this forum - thanks for keeping us in the loop.
This is really great to hear! It's really encouraging actually. The bulk of my evenings between 8-11pm are spent on this nightmareproject. To hear that it's helping people learn is very useful to keep one's motivation up.

srepho wrote:I just had one suggestion and one question (apologies if it was picked up already or would have been fixed anyway). A lot of times in the text you refer to line numbers, it would be awesome if the code snippets could also have line numbers as well.
Very sorry to hear about this. Particularly in the first few chapters, my Asciidoc-fu wasn't amazing. I'll try to make sure that these are all cleaned up before the MEAP is updated.

srepho wrote:As a data scientist and noticing your bio mentioned an interest in nlp and ml I was wondering if you saw Rust having a role to play in this area? I have seen some blog posts and talks about creating Python extensions for example and would be interested to hear your thoughts on where Rust is most useful for someone who works mostly in Python and R.
This is actually the reason I learned Rust! I've been programming in program for about a decade but have always been too scared of writing a C extension. It always seemed like the Dark Arts to me.

So, I really really hope so, but I think that the learning curve for Rust-as-a-primary-language is too steep for incidental programmers (a term I use to describe people who use programming get work done, but who shudder at the idea that they're "programmers"). So that leaves larger tools.

datafusion and timely-dataflow look like excellent projects to learn. If they could be given ergonomic Python wrappers, I think that there would be a really good chance that Rust skills wouldn't be necessary to use Rust-based projects. One route is via the Apache Arrow project, for which the datafusion project supplied the Rust wrappers.

I haven't seen much natural language processing and text mining in Rust - but I haven't really been looking.
Welcome to the latest progress report for Rust in Action, a book on the Rust programming language for intermediate programmers that teaches Rust via systems programming.

Several chapters are already currently available via Manning's Early Access Program (MEAP). If you don't own the book and would like to preview its contents for free, visit the book's liveBook page. To get there, visit the book's webpage and click "Look inside".

Book Progress

Chapter 7 should be published shortly. It is going through a few stages of editorial review. Even though this book is a MEAP, we don't want to release something that causes confusion. The chapter is quite large and there have been internal discussions about splitting into two or three smaller chapters. The chapter takes readers through the process of building several key/value stores and discusses how hashing and B-Trees operates.

With upcoming changes to the concurrency landscape in Rust (esp. Tokio stabilization due in July), I've decided to work on another chapter: Time.

Time covers: representing time in a digital computer, how hardware and software clocks work and how NTP operates. There's no need to be mystified by how this process works. Readers will be writing an NTP client from scratch!

If you would like to do some pre-reading, I've made one of the code projects available for review here: https://git.nzoss.org.nz/tim-mcnamara/timepong. I'm hoping that this project will outlive the book! If you have Rust installed, you should be able to keep your system's time in sync right away!
19705 wrote:Hi,

I have just made it through to the end of chapter 6 now and I have to say it is an amazing book so far! It goes a lot deeper into lower level areas than the other Rust books which really helps. Thankyou so much for writing it.


And thank you for this feedback! It's really heartening. Writing a technical book is as hard as everyone says it is! And because the other Rust books are of such high quality themselves, it makes the threshold even higher.

On page 168 you say it can be costly to reach the capacity of the TLB (typically around 100). Do you mean 100 bytes? Is this the value that is returned by std::mem::size_of<>()?


This is a good question. No, it relates to the CPU's word size (isize and usize). Intel CPUs have 128 slots in the TLB, half for data and half for code. And it gets even more complicated than that as the TLB is split into L1 and L2 cache itself. There's lots of complexity there, which meant that the chapter took a lot more time than I had originally budgeted. I hope that the balance has been struck.

Are there any idiomatic tricks in Rust that you can use to keep your data structures smaller, or is it purely down to the design of the code? Time and space allowing, I would love to see some examples here. A program with an inefficiently sized data structure that runs slowly, then refactored so that it fits in the TLB and runs demonstrably faster - although I do appreciate that could be a whole chapter (maybe even book) in itself. My appetite has definitely been whetted!


Difficult question.

I think that a good rule of thumb is that if you can keep to types that implement Copy, your program should run very fast. This implies numeric types such as integers and floating point values.

Deeply nested structures with lots of pointers will lead to cache thrashing. But it's not that simple. As part of the development of the chapter, I experimented with several programs to see if I could make things deliberately slow. But the compiler was always too smart and much of my deliberately inefficient code was optimized away.


Looking forward to the next chapters!


They shouldn't be too far away. There are about 80 pages awaiting release that just need an extra few tweaks before they get released smilie

If you would like to take a sneak peek, you are welcome to check out the NTP client that I have written that will be explained in chapter 9 or so: https://git.nzoss.org.nz/tim-mcnamara/timepong

Thanks again for the words of encouragement. They're very helpful.
Welcome to the April 2018 progress report for Rust in Action, a book for intermediate programmers who want to learn about Rust and systems programming.

Over the last last two months, I've spent lots of time thinking about how to explain the concepts of files, file systems and databases. That's resulted in multiple implementations of a key/value storage engine that is able to guarantee that it will never become corrupt - even in the case of a hardware failure. Unfortunately, that's resulted in a very large chapter that's not quite polished enough. I've sent a number of drafts to Manning's editorial team and hope to have a revision ready for a public audience this week.

The chapter also takes time to explain some important computer science concepts: hashing and trees. If you've never taken a computer science course, don't worry! This should be a good introduction to the topic.
559249 wrote:Apple have no plans to rename or incorporate iOS into macOS. Quite the opposite, as they now have watchOS and tvOS. It’s crystal clear on their Developer site: https://developer.apple.com/discover I’ve also been developing apps for iOS since the SDK was first released in 2008 along with iPhone 3.


Sincerely appreciate the references. Will revert.
A reader reports that ch1-time-api won't build! Adding a note here so that it's fixed before release.
KOZAKI wrote:my MEAP version is v5.

in Listing 1.2.

for region in region.iter() {
    println!("{}", &region);
}


Since the type of the region variable is &&str, should I write println!("{}", *region) ?


Thanks for the question. It's a very good one. (For reference, you can view the code that you refer to in context via the liveBook.)

The code in the listing compiles as-is (https://play.rust-lang.org/?gist=0a6e3ecd45c79aed199e6c3d7f15b270&version=stable). Rust will actually automatically dereference variables when they're accessed. But, most Rust programmers would argue that the listing should be improved.

This code is more idiomatic as slices become iterators when used in a for loop. Formally, they implement IntoIterator, which is what the for loop desugars into.

fn greet_world() {
    println!("Hello, world!");  // our old friend.

    let southern_germany = "Grüß Gott!";
    let japan = "????????";

    let regions = [southern_germany, japan];

    for region in &regions {          // <--- these lines 
            println!("{}", region);   // <--- are different
    }
}

fn main() {
    greet_world();
}


Do let me know if this answers your question! If any of the terminology is unclear, I recommend reading through chapters 2 and 3. If things are still unclear - please feel free to ask for more info and I will point you to some more resources smilie


The team at Manning informs me that the Rust in Action MEAP will be updated shortly.

What does chapter 6 cover? Here is an excerpt from the introduction:

This chapter covers

• What a pointer is and why some of them are “smart”
• What the terms “the stack” and “the heap” mean
• How a program views its memory and why that’s a lie

The chapter provides you with some of the tacit knowledge held by systems programmers about how the computer’s memory operates. It aims to be the most accessible guide to pointers and memory management available. You will be learning about how applications interact with an operating system. Programmers who understand these dynamics can use that knowledge to maximize their programs' performance, while minimizing their memory footprint.


For this chapter, I'm actively soliciting suggestions for improving the text. It's been several weeks' work so far and I feel that I am too close to be objective. Please let me know what you think!
Congrats Jaime & John. Massive achievement.
Welcome to the latest progress report for Rust in Action, a book on the Rust programming language that's currently available via Manning's Early Access Program (MEAP). If you don't own the book and would like to preview its contents for free, visit the book's liveBook page.

First of all, sorry that this report has been so delayed. I wanted to wait until there was some concrete news to report (and concrete news has seemed imminent for a while). That concrete news is that the latest chapter is being prepared for publication.

Book Progress

Writing was a hard slog in January. Chapter 6 contains dozens of code examples and diagrams, in addition to many pages of content. Each of them took a few hours to produce, check, revise and re-check. Ultimately, it's been a very slow process.

There are a few other excuses:

I set myself the goal of making the world's most accessible introduction to pointers and memory management. That goal did not play nicely with my perfectionism.

As I mentioned in my last report, our family welcomed a new edition on the 1st of Jan. Her first month was a happy and healthy one, but it did impact her parents' sleep schedules quite a bit.

Oh, and my main's computer's power supply decided to retire early. It was an HP z600 workstation, which happens to have a bespoke power supply setup. New Zealand tends to shut down during January and I'm still waiting on a replacement part.

Regardless - I want to assure readers that the project has not stalled. In a few days, you should receive the latest chapter.

Wider Updates

The book was Manning's deal of the day on Jan 27. The deal of the day promotion provides 50% off the retail price. Timing is controlled by Manning's marketing team, and Rust in Action appears every few months. If you would like to subscribe to updates, visit https://www.manning.com/dotd
531878 wrote:Hi Tim,
I'm wondering what is the relationship between your CHIP8 CPU emulation and the WebAssembly CHIP8 Emulator at https://github.com/ColinEberhardt/wasm-rust-chip8?

Are you borrowing from each other or from a common original source?

Andrew.


Hi Andrew, no I didn't know of this implementation when I started writing the code example. I actually spent most of my time comparing my results with a Go project that I have forgotten the name of right now.

One of the reasons for choosing CHIP-8, apart from simplicity, was that there are many implementations already. I didn't want to do something completely novel because I thought that readers might enjoy reading more about retro computing and loading up their own ROMs etc.
259798 wrote:Just noticed a small typo on page 129, in footnote 7:

Shift op_byte1 left to occupy the left-most buts of the u16


Urgh. I hate these kinds of typos. Thanks for reporting it!
Welcome to the December 2017 update for the Rust in Action MEAP. Rust in Action is a book that aims to teach you to the language as well as introduce you to the world of systems programming.

About the Upcoming Chapter

First of all, the bad news: I wasn't able to get chapter 6 through to the editors by the end of the year. The good news is that the reason is that I'm trying to focus on quality, rather than pure pace. When I rush the work, it becomes harder to read and the examples are more bug prone.

Chapter 6 focuses on memory. It covers three main topics:

1) describing what "memory" means to an OS, a CPU and a program. Each element has slightly different idea
2) what pointers are, and how they might be different from other related terms such as reference and address. Also, what is meant by fat pointer, smart pointer, unique pointer, etc? If you're new to the domain, encountering something one of them (and I've noticed that they slip into the Rust community discourse fairly often) in can be frustrating and confusing.
3) What is meant by the term "allocation" and how do you inspect and tune an allocator?

Here is a taste of the examples that chapter 6 covers:

- a memory inspector, as used by gamers to cheat by modifying a game's state in-place
- an address space visualiser: create PNG images of a program's memory to study entropy/wasted space/readable text
- how to benchmark an application to decide between 4 choices of memory allocation (incl. how to evaluate a 3rd party allocator)

There have been a number of dead ends to get to where we are now though:

- I spent some time implementing a toy ray tracer for the allocation evaluation sub-topic. Unfortunately, that needed to be scrapped (for now) because it took the reader too far away from talking about computer memory
- I also looked into creating a strange attractor renderer (and other assorted bits from complexity theory). This ended up being a black hole of a time suck because it's far too fascinating.


Family/Personal Stuff

My productivity has also been affected by two other important considerations:

- end of year rush at work
- holidays / wanting to relax with family - it's been an amazing summer here in New Zealand and I don't want to miss all of it
- welcoming a new baby, who joined the world on 1 Jan smilie

Plans for January

I'm hoping to get a lot of content written in January as I have some parental leave. Fingers crossed I'll be getting enough sleep!

Thanks and reading options!

Hopefully the next MEAP update will be with you soon. If you haven't purchased the book, you are welcome to preview it via Manning's liveBook feature. (Click "Look inside!" on the book's homepage)
The publisher informs me that chapter 5 is due to be released to readers very shortly. Exciting! Please add any corrections to the text that you find. Really hoping that you'll enjoy working through the chapter. Do make sure to dig into the source code folder, as it contains a bit of an Easter Egg for MEAP readers.

If you haven't purchased the book yet, you are welcome to read the liveBook text for a preview.
November has a very productive month. The next MEAP should be out very shortly.is out!.

The chapter includes some neat material that I'm hoping will be rewarding and enjoyable to work through:

• implementing a CPU in software
• designing your own number format
• extracting individual bits from bytes
• deconstructing floating point
• quite a bit more!


You'll notice a change in approach with Part 2. We're really starting to introduce systems programming concepts into the book. Part 1 probably has 85% of its new material as Rust, 15% systems programming. Part 2 is the reverse. New concepts will be roughly 85% on the systems programming side, with code examples reinforcing Rust that was skimmed over in the early chapters.

The focus of November was been to add features, rather than fix bugs. If you have submitted to the forum and/or participated in the review, please know that I do appreciate your comments and they will be addressed in Q1 2018.


Highlights of the month

• Chapter 5 has been submitted for publication. It has been passed through the eyes of a general editor and a technical editor and should be with you very soon.
• Chapter 6 is in the advanced stages. I'm hoping to have it finalized before the 17th so it will be with you before the end of the year.
• Invisible to readers, but still important, were are few internal Manning processes that have been completed. The senior staff are very happy with the book's progress. (Phew!)

News & Special Offers

• Manning's marketing team tells me to let readers know that they should monitor their Countdown to 2018 event for heavily discounted prices on its products (as well as some fun quizzes!). I believe that Fridays (in the USA) are especially rewarding.
Rust in Action has a Facebook page that you're welcome to follow. I am quite bad at Facebook though, so my Twitter account tends to have much more regular updates.
• I have begun to try document interesting (non-Windows, non-UNIX) operating systems and their aims. Do you know of any? I'm missing plenty.
• Would you rewrite the Linux kernel in Rust? I do my best to avoid a flamewar on Quora on that question.

Questions for Readers

• Would you like to be acknowledged by name in the book's acknowledgements section? If so, please send me a private message (many forum participants don't provide their name).


Thanks all for your support.

TS McNamara
October has been a productive month for Rust in Action. One chapter has been released, Manning commissioned 11 independent reviews and the next chapter is nearly ready. I'm expecting that the bulk of part 2 will be released before Christmas.

Highlight: Reviews In

I really appreciated the time taken by the reviewers to send their thoughts through to Manning. Every reviewer added something that will benefit every future reader. Thank you.

Here are few quotes that I was really touched by and/or thought were worth sharing. Authors are not provided with the names of the reviewers, and so I can't provide proper attribution unfortunately. I've added each reviewer's description of themselves in lieu of a name.


  • This is simply the best programming language book I have read in a very long time (possibly ever). I love the combination of teaching a language and systems programming. If you want to learn Rust while also learning about systems
    programming, this is likely a book for you.
    — "I am a programmer, running my own consultancy business. I have a background in programming (the last 30 years or so), mostly systems programming and high performance/availability/scalability systems."

    Explanation of vec vs array was really good, best I've seen so far.
    —"Sysadmin, python dev, "DevOps", "SRE""

    Densely packed but very approachable, anyone with previous programming experience will find this book an excellent introduction to Rust.
    — "Head of IT Operations at an online travel company"

    The online resources I've seen take a much more theoretical approach to the material, where this book makes Rust more concrete in a "here's what you do, here's why, but you need to know _this_ part..."

    I did not get bored reading it.
    — "I am a web developer primarily. I have worked for 15 years mostly in the .NET Framework and JavaScript."

    The writing is interesting, nice and concise and not a lot of fluff. Held my attention just fine even after a full day's work. ... The easiest way to learn Rust that I have ever seen!
    — Java developer for 20+ years, background in C, Scala and Akka.

    Looks very good. I have read some other Rust books from other publishers but this one is a bit different and visualizes things a bit more clearly.
    — "1 year experience in Rust, 8 years experience in Python and JavaScript."



  • One thing that I picked up on is that Rust is not perceived as an easy language:

    [The book] does a good job of explaining Rust which not the easiest language available.
    — "I am a web developer primarily. I have worked for 15 years mostly in the .NET Framework and JavaScript."

    I think that Rust is a little more difficult to learn that some languages, so I wouldn't call it "easy," but I feel like I'm making progress in understanding things.
    — "Run a startup and programming group."


    As you can see, opinion was largely very positive although the book isn't to everyone's taste. The two reviewers who placed negative reviews felt that the text was a little too sloppy in places. That's an easy fix and one that I'll certainly be focusing on as I continue writing. It's probably true that I have been rushing a little bit to make deadlines.

    Admirable idea / approach for a book, but I'm afraid the writing really lets it down.
    — "I am a full-stack engineer, currently handling infrastructure and devops at a startup."



    Naturally, some people loved the same thing that others hated:

    The spiral thing went completely over my head.
    — "Consultant CTO. Decades of technical experience."

    I really liked that spiral shape of grammar features.
    — "1 year experience in Rust, 8 years experience in Python and JavaScript."


    Overall, reading the reviews was very rewarding. It's been a difficult road already and the book's only 1/3rd of the way through. Some of the positive comments really helped to remind me that the effort is worth it.

    Highlight: Part 2 Incoming

    I'm very excited about chapter 5: Data. I've been able to implement a CPU emulator as well as a compact number format for storing machine learning numeric data. The text surrounding those implementations is still slightly scrappy though, but hopefully you won't need to wait long before digging your teeth in!

    Lowlights

    It's been a difficult month for me personally. Sleep has been very hard to come by at times and family issues have been remarkably stressful and a real distraction. It's been a challenge to balance the needs of writing, working, raising a family and keeping myself healthy.

    Should you buy the book?

    This is a very fair question. I think so. Most readers seem to be enjoying the book. The issues that some readers have found with the material should dissolve over time.

    My aim has always been to write a book that takes weeks off of people's learning time. It looks like that's happening.


    55925 wrote:Hello Tim,

    I just ended reading the first chapter and want to give some feedback. But first of all, to put my comments into perspective: I am a Java EE developer with some contact to Scala, a bit of Haskell and others, was working with C quite some 25 years ago. Beside that, I am no native English speaker.

    From what I read on the web this may be a not so rare profile for people starting to look into systems programming with Rust.
    ....


    Thank you so much for taking the time to write this comment! The chapter will certainly be revised and this feedback will help immensely.
    Chapter 4 is now available in MEAP. It takes a different approach to its teaching style by introducing a new form of diagrams. The chapter also uses the idea of managing communication between satellites as its main example for the chapter, rather than something more concrete.

    What do you think?
    Chapter 3 - Compound Data Structures - is live. It is the end result of a significant rewrites and refactors, so do let me know if there are any issues with flow. The chapter covers a great deal, but I really hope that it's a worthwhile read.
    Hello all, chapter 3 should be with you now! Expect chapter 4 & 5 soon smilie

    A more thorough report will be with you soon.
    267849 wrote:I hope the dependence on nightly will go away for the published version, the ecosystem instability caused by everything depending on some version of nightly seems to be a favorite argument among detractors. And there is half a sentence missing in "Execute rustup install nightly . This enables extra features to ."


    First of all, apologies for the missing half sentence.

    Yes, I am hopeful that nightlies won't be required by the time the book goes to print. It's a difficult choice for me to make. Do I pin to a version, say 1.20, and then make the book seem to be over a year old by the time it comes out? At this stage, I'll go for nightly and reconsider when the bulk of the work is done.
    267849 wrote:"the preceding code would fail to compiler"

    And I think this is an unconvincing example with a rather unhelpful error message. For comparision, common C compilers with sensible options will pinpoint the actual issue exactly and suggest appropriate fixes: ...


    This is a fair point. I muddled around for a few hours attempting to think of an example that was concise yet compelling. At the end of the day though, I certainly recall the frustration of using the assignment operator when I meant to be comparing values when learning to code. If I get any ideas over the next few months, I will certainly inject them into the prose!

    "mismatched types" can't hold a candle to this from an ergonomics standpoint. One could make a point that it is nice that the compiler doesn't need a special case rule for this error, but that makes it easier for the authors and not the users of the compiler.


    I also agree that the error message could be improved.. I wonder if assignment is being used within an expression that will be evaluated by a logical test whether something more direct could be said, "Perhaps you meant == rather than =?"
    267849 wrote:Section 1.3.3:

    "Rust’s referencing system are->is implemented as"

    It it also not clear what referencing here refers to, it is most likely the reference counted boxed objects (Rc/Arc), but in the context of rust the word is also used for references (&) to values. So maybe "Rust's reference counted values are implemented as...". And is this even useful knowledge at this part of the journey?

    The part starting with "There are design decisions" doesn't completely fit under "Size of the Language", instead it repeats parts of the other "Downsides" subsections (and 1.3.3 itself).


    Agree that the language and structure is fairly muddled in this section. Some editorial surgery will be required to enhance the flow and comprehensibility. Thanks for pointing this out. It's surprisingly obvious when someone quotes your text, but very difficult when one is in the middle of writing a large block of text.
    267849 wrote:"Rust is likely to have helped" - shouldn't there be a "would" somewhere in there?


    Perhaps this is a New Zealand-ism? It sounds natural to my ears, but perhaps a more conventional sentence structure would be more appropriate.

    "The issue lies between lines 11 & 13." The listing does not show line numbers, will this be different in the final version?


    Yes! Urgh, I thought that I had fixed all of those. Thanks very much for reporting the issue.
    267849 wrote:macOS -> iOS


    Controversial point. From memory, my technical ed actually asked me to remove iOS in favour of macOS. I also had ObjectiveC in there, rather than the current Swift. I believe macOS is the current name though and will better serve future readers.
    267849 wrote:Systems languages tend to be powerful, but unwieldy [missing: for example by requiring explicit memory management and careful attention to the types of values. Rust tries to provide the power without this unwieldiness]. Some languages get around the memory management problems by having a GC, but rust solves this differently. And while rust is statically typed, the compiler is smart enough to take away much of the pain.


    This is an extremely helpful suggestion. I certainly want to improve chapter 1. Its a bit of a Frankenstein at the moment. Quite a lot has been pulled together from other writing. Will work hard to smooth things out.

    267849 wrote:And I'd qualify it as most of the convenience of a garbage collector, at the end of the day the borrow checker is a pedantic nitpicker which most garbage colletors are not.


    Fair point!
    267849 wrote:The code doesn't compile:
    println!("a: {}, b: {}, c: {}, d: {}", a, b, c, d);
    


    Try
    println!("a: {}, b: {}, c: {}, d: {:?}", a, b, c, d);
    .

    This makes use of Debug, rather than Display but should get you past the compiler. Apologies for the error. Niggles like that are annoying!
    Summary

    This month has been quite difficult yet also very encouraging. A new chapter is not yet ready, but is not far away.

    Major highlight: reader feedback

    Early feedback has been utterly fantastic. I'm absolutely delighted that people are learning a lot from the material. Of a few good ones, here is my favourite quote:

    I purchased this book and went through the available 2 chapters pretty quickly and I definitely recommend it to others. Tim's writing is clear and the way he focuses on the design motivations behind Rust first made the technical introduction much easier to read.

    I went on to read the Second Edition of the RPL book and found that it was much easier to focus and understand than when I tried the first time.

    /u/meantball


    What I've written this month

    I've produced about 6k words of copy, a dozen or so code examples and about 6 in-depth diagrams. Unfortunately, I'm not quite ready to submit chapter 3 to the publisher. There are a few more refinements required before the chapter really flows. I also need to cut out a lot of duplicate content from past revisions (the raw source file contains 14k words!). If you are very keen, send me a message and I'll forward you a raw chapter manuscript as-is.

    More highlights

  • It's been satisfying to see my writing practice improve over time. Each of those code snippets and diagrams tends to take over an hour. Often several for the case of diagrams. But the results are good and people are learning

  • Anecdotally, sales have been good. I haven't received an official count from Manning yet, but it's certainly more than the 100 or so that I was expecting in the first month. My goal is to sell 1k copies by the end of MEAP and hopefully reach 10k in the book's lifetime.

  • I'm very grateful to the marketing team at Manning. They've produced a slide deck taken from chapter 2. There should also be some extra free content available online shortly.

  • Thanks to Daniel Holmlund from Intel who has accepted an invitation to be an official reviewer for the book!



  • Lowlights

  • My productivity during the month been marked with sickness and work stress, sadly. I've also had multiple 2-5am awake spells over the course of the month that have made it difficult to concentrate in the following evening (when I have time scheduled to work on the book)



  • Calls to Action

  • Read the book! Check out Manning's liveBook version, which is free to read.

  • Buy the book! Rust in Action is on special! Use the code WM090117LT at checkout to receive a 50% discount.

  • Become an official reviewer! Manning has asked me to compile a list of individuals who might be interested in reviewing the book at 1/3rd, 2/3rds and at 100%. Send me a note if you would like to be included on that list



  • abattisti wrote:Don't know if this is the right place, but...


    Thanks very much of these corrections, Alex! I'll make sure that they're included in the next version of the MEAP. This is the perfect place for them. Thanks once again smilie
    500923 wrote:I'm loving this book, Tim! I love the hands on approach rather than the feature-by-feature approach in 'The Book'.

    My only disappointment is that the completion date is so distant!

    This is my first time purchasing a Manning book. Will we get new chapters as you complete them?


    I'm absolutely blown away by this comment. Thank you so much for taking the time to create an account and post a message. It's really quite touching.

    It was a big call to go up against a book that's so prominent as "the Book". Manning and I have spent over a year refining early drafts and several iterations of the Table of Contents. Rust in Action is deliberately very different. It isn't seeking to be an authoritative reference textbook, which provides a little more freedom.

    Manning has invested a great deal of effort to produce a high quality, compelling book. Each of the chapters is reviewed by a team of about 3 staff (oftentimes it's been more) before hitting external review. It's really nice to hear positive feedback, as it's been quite a process to even get this far. About ~150 pages are just-about-ready to be released.

    My personal goal is to be complete by about Feb 2018. However, we want to allow lots of buffer time because a lot of the projects are quite technically challenging. That challenge means that it's possible that we'll encounter errors. What makes things even more challenging is that code needs to refactored for readers with a wide range of programming experience and backgrounds.

    You'll certainly be receiving chapters as the project develops. You'll also receive copies of changes to the ones you've already received. I've also left code examples from discarded projects in the code pack for you to dabble with.

    Thanks again for the positive feedback, it's tremendously helpful.



    Minor comment about section 2.2: "floating point (f) is able to represent real numbers" would be better if it said "approximate" instead of "represent".


    That's very true! I actually wrestled with this and wondered if I should mention that it's actually representing a range rather than a real number. I've ended up pushing that to chapter 5, which talks a lot about how data types are represented in the machine.

    And related to this, there is an introduction to formatting macros for integer based types... Can you add some examples of formatting macros for floating point types?
    Side note: I am curious if there is a formatting macro for printf! for outputting a float as a hexfloat formatted string?


    Sure thing. This is also in ch5. Here is a bit of a hint:
    fn main() {
        println!("{:x}", 42);
        println!("{:b}", 1024);
    }
    


    Bit manipulation is a great skill! I'm actually considering chatting about the graph6 data format, which is a way of encoding adjacency lists in a very compact manner.

    If you would like, I can send you a pre-pre-release chapter 5 that still needs some editing if you're interested. Send me a pm. Thanks for the comment!
    Wow, MEAP is live! Thanks to everyone who has purchased the book. Manning puts in an astonishingly large amount of effort to ensure quality. Even by the time the PDFs reach you, they have typically been reviewed by 3 staff with very thoughtful comments.

    Progress this month:

    • 2 chapters released
    • Facebook page launched (https://fb.me/rustinaction)
    • lots of social media chat, especially on Twitter

    Goals for August:
    • (pre-written) drafts for cc 3-5 revised and submitted to editors
    • chapter outlines for part 2 complete
    The book now has a Facebook page that will be used for updates if you want to monitor the book's progress: https://fb.me/rustinaction
    Manning informs me that people are actually buying the book! That means that it's time to start a placeholder topic for Chapter 2. Do feel free to ask any questions or offer advice!
    This forum is the primary place to ask questions about the book and to offer suggestions about improvements.

    Still, if you would like to chat to the author in a less formal--or less public--manner, there are plenty of other options:

  • send me a private message or email

  • connect with me on Twitter, LinkedIn, Reddit or the Rust users' forum


  • I maintain a technical blog at http://always-learning.timmcnamara.nz/ that you're also welcome to explore.

    Absolutely delighted to receive any feedback on the introductory chapter of Rust in Action. It's had quite a large number of revisions as the table of contents has been revised.

    Please let me know if there is any content that should be culled or expanded.

    If you haven't purchased the book yet, you are very welcome to read the liveBook edition. This chapter is available in full smilie
    Dr. Björgvinsson, just wanted to say that the book looks really interesting. Am excited to follow its progress.
    438697 wrote:What happened to the site -- really wanted to check out the tools -- even though the material might be dated - it still would be nice to see the materials (it is part of the reason I bought the book ;-( )


    Looking at the Wayback Machine history, it looks like the site became defunct some time within 2016. Luckily, much of the content from 2009 looks like it has been preserved, including some of the resources.