Syntax of method calls
categories: hacking
tags: rust
Description/Summary
Idiomatic way of method calls in Rust.Content
Method chaining while reading
- leftwards:
a.foo().bar().whatever()
- rightwards:
B::bar(A::foo(Z::whatever(something)))
a.foo() -> Type B {}
b.bar() -> Type Z {}
For the readability, you almost always use .
to call a function.
This is the idiomatic way.