counter.aug diagrams
Read access and mutable borrows
Project overview · Compiled explanation
Class interactions
Mermaid source
flowchart TD
n0["Counter"]
n1["ICounter"]
n0 -->|"implements"| n1
Sequences
Call arrows identify checked targets; loop and branch frames determine when they run. Open that target’s module to follow its implementation. Branches describe alternatives; loops describe repeated work. Native calls and interface dispatch stop at their declared contracts. Exit notes end that path; enclosing recovery and cleanup remain visible.
Counter constructor
It implements ICounter.
It takes value as an integer, kept mutable.
Receive fields: value. Explanation.
Counter.increment
It may change self.
Mermaid source
sequenceDiagram
participant p0 as Counter.increment
rect rgb(245, 240, 241)
Note over p0: Enter borrow scope
Note over p0: Set value to value + 1
Note over p0: Leave borrow scope
end
Counter.read
Return value; required cleanup runs before exit. Explanation.
ICounter.increment
It may change self.
Interface contract; implementation selected at runtime. Explanation.
ICounter.read
It returns int.
Interface contract; implementation selected at runtime. Explanation.
Called contracts
- ICounter — counter.aug