liveBook · Manning

Promise

As explained in Rust Servers, Services, and Apps

A JavaScript promise is an object representing the eventual completion or rejection of an asynchronous operation and its resulting value.

A JavaScript promise represents the eventual result of an asynchronous operation. Browser work such as fetching a URL or loading an image can proceed without blocking the current thread. section 10.3

Promise and Rust future

Use a promise as the JavaScript analogue of a Rust future: both represent deferred computation and a later value, but a promise carries higher-level semantics such as rejection. A Rust future is lower-level and can be polled for readiness. section 10.3

How Rust Servers, Services, and Apps covers it

How deep it goes
Defines promise semantics and contrasts them with futures, but stops short of JavaScript promise construction or chaining APIs.
Examples
Uses browser URL fetches and image loading as concrete asynchronous operations represented by promises.
What it assumes
Assumes familiarity with asynchronous processing and introduces the promise–future analogy in the context of Rust async programming.
What you can do after
Evaluate how JavaScript promises correspond to Rust futures while recognizing rejection as a higher-level promise behavior.
How it connects
Connects promises with asynchronous processing, deferred computation, futures, async functions, and nonblocking network requests.

Also explained in

Compare how 7 books explain promise →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Rust Servers, Services, and Apps. The section links point to the parts of the book it draws on.