Skip to content

Commit 8b0a29b

Browse files
committed
Rack::is_recording
1 parent 43a7e62 commit 8b0a29b

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "logicline"
3-
version = "0.1.7"
3+
version = "0.1.8"
44
edition = "2021"
55
authors = ["Serhij S. <div@altertech.com>"]
66
license = "Apache-2.0"

src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ pub mod global {
6464
GLOBAL_LADDER.lock().set_recording(recording);
6565
}
6666

67+
/// Is the global rack state recording
68+
#[cfg(feature = "recording")]
69+
pub fn is_recording() -> bool {
70+
GLOBAL_LADDER.lock().is_recording()
71+
}
72+
6773
/// Creates a snapshot of the global state
6874
#[cfg(feature = "recording")]
6975
pub fn snapshot() -> super::Snapshot {
@@ -528,6 +534,12 @@ impl Rack {
528534
pub fn set_recording(&mut self, recording: bool) {
529535
self.recording.store(recording, atomic::Ordering::SeqCst);
530536
}
537+
538+
/// Returns `true` if the rack is recording
539+
#[cfg(feature = "recording")]
540+
pub fn is_recording(&self) -> bool {
541+
self.recording.load(atomic::Ordering::SeqCst)
542+
}
531543
}
532544

533545
/// Processor is an instance which creates logical lines

0 commit comments

Comments
 (0)