A fluent interface expresses a sequence of operations through chained method calls. Each method returns a value that provides the next operation, and a final call terminates the chain. The pattern builds on the builder pattern and appears in Rust’s Iterator trait. section 5.4 section 5.8
Rust implements chaining through return types. Iterator::map returns another Map iterator, so another map call can continue the chain. The returned type carries the next available operations. section 5.4
A fluent builder
A builder can return a new builder from each assignment method: let bicycle = Bicycle::builder() .with_make("Trek") .with_model("Madone") .with_size(52) .with_color("purple") .build(); Here, each with_* method returns Self, allowing the next call; build ends the operation and produces the bicycle. section 5.4.1 section 5.4.2
These builder methods take self rather than &mut self, consuming the previous builder. Each call constructs a new builder and inner Bicycle, using struct spread syntax to preserve unchanged fields. This approach works with owned values but not references. section 5.4.1
fn map<B, F>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Item) -> B { ... }
Inspect the Iterator::map signature to see how a concrete return type enables another operation in the chain. section 5.4



