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.
D3.js in Action, Third EditionA JavaScript Promise is an object representing the eventual completion or failure of an asynchronous operation and its resulting value.
Promise.allused by · Promise.all is a JavaScript static method that returns a promise fulfilled with an array of results when all input promises fulfill, or rejected if any input promise rejects.
Promise.raceused by · Promise.race is a JavaScript static method that returns a promise settled with the outcome of the first input promise or thenable to settle.
async/awaitproduced by · Async/await is language syntax for expressing asynchronous computations that suspend at awaited operations and resume when they can proceed without blocking the execution thread.
dynamic importproduced by · Dynamic import is a language feature that asynchronously loads a module at runtime and returns a promise for its module namespace.
async iteratorused by · An async iterator is an iterator interface that asynchronously produces successive values for consumption over time.
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.