Skip to content

Commit c95e306

Browse files
committed
README.md
1 parent 9b580c9 commit c95e306

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ let processor = rack.processor();
7272
```rust,ignore
7373
use logicline::{action, Rack};
7474
75-
let mut state = Rack::new().with_recording_enabled();
76-
let mut processor = state.processor();
75+
let mut rack = Rack::new().with_recording_enabled();
76+
let mut processor = rack.processor();
7777
7878
// Some fan state
7979
let mut fan = false;
@@ -98,13 +98,13 @@ processor
9898
Some(())
9999
}));
100100
101-
state.ingress(&mut processor);
101+
rack.ingress(&mut processor);
102102
```
103103

104-
When recorded, the state can be printed in a human-readable format:
104+
When recorded, the rack state can be printed in a human-readable format:
105105

106106
```rust,ignore
107-
println!("{}", state);
107+
println!("{}", rack);
108108
```
109109

110110
```ignore
@@ -115,7 +115,7 @@ fan_on: temp_high(31.0) -> fan_on
115115
Or serialized, e.g. to JSON for web visualization:
116116

117117
```rust,ignore
118-
let serialized = serde_json::to_string_pretty(&state).unwrap();
118+
let serialized = serde_json::to_string_pretty(&rack).unwrap();
119119
```
120120

121121
```json
@@ -260,11 +260,16 @@ automatically sorted by their names.
260260

261261
## Performance
262262

263-
When the recording is disabled (either feature or the runtime state/processor
263+
When recording is disabled (either feature or the runtime state/processor
264264
flag), the logic lines bring almost no overhead in comparison to the
265265
traditional combinators, such as similar methods of [`std::option::Option`] and
266266
[`std::result::Result`].
267267

268+
When recording is enabled, it is recommended to clone rack instances before
269+
processing them in case if the instances are under Mutex or RwLock. This can be
270+
performed either with [`Rack::clone`] with [`Rack::snapshot`] methods. The
271+
second variant returns a [`Snapshot`] instance which contains line states only.
272+
268273
## Data visualization
269274

270275
The crate `exporter` feature provides a built-in exporter (HTTP server) for

0 commit comments

Comments
 (0)