1#![deny(missing_docs)]
2#![forbid(unsafe_code)]
3#[doc(hidden)]
9pub extern crate inventory;
10
11pub mod codegen;
12pub mod error;
13pub mod event;
14pub mod recording;
15pub mod registry;
16pub mod snapshot;
17pub mod types;
18pub mod verification;
19
20pub use codegen::{CodegenOptions, CodegenStyle, generate_test, generate_test_default};
21pub use error::VictauriError;
22pub use event::{AppEvent, EventLog, InteractionKind, IpcCall, IpcResult};
23pub use recording::{EventRecorder, RecordedEvent, RecordedSession, StateCheckpoint};
24pub use registry::{
25 CommandArg, CommandInfo, CommandInfoFactory, CommandRegistry, ScoredCommand,
26 auto_discovered_commands,
27};
28pub use snapshot::{DomElement, DomSnapshot, WindowState};
29pub use types::{Divergence, DivergenceSeverity, MemoryDelta, RefHandle, VerificationResult};
30pub use verification::{
31 AssertionCondition, AssertionResult, GhostCommand, GhostCommandReport, GhostSource,
32 IpcIntegrityReport, SemanticAssertion, check_ipc_integrity, detect_ghost_commands,
33 evaluate_assertion, verify_state,
34};
35
36pub fn acquire_lock<'a, T>(
41 mutex: &'a std::sync::Mutex<T>,
42 context: &str,
43) -> std::sync::MutexGuard<'a, T> {
44 mutex.lock().unwrap_or_else(|poisoned| {
45 tracing::error!("{context}: mutex was poisoned, recovering");
46 poisoned.into_inner()
47 })
48}
49
50pub fn acquire_read<'a, T>(
52 lock: &'a std::sync::RwLock<T>,
53 context: &str,
54) -> std::sync::RwLockReadGuard<'a, T> {
55 lock.read().unwrap_or_else(|poisoned| {
56 tracing::error!("{context}: RwLock was poisoned, recovering with read guard");
57 poisoned.into_inner()
58 })
59}
60
61pub fn acquire_write<'a, T>(
63 lock: &'a std::sync::RwLock<T>,
64 context: &str,
65) -> std::sync::RwLockWriteGuard<'a, T> {
66 lock.write().unwrap_or_else(|poisoned| {
67 tracing::error!("{context}: RwLock was poisoned, recovering with write guard");
68 poisoned.into_inner()
69 })
70}