pub struct ProofLogger { /* private fields */ }Expand description
Streams proof steps to a binary log file during solving.
§Examples
use std::path::Path;
use oxiz_proof::logging::ProofLogger;
use oxiz_proof::proof::{ProofStep, ProofNodeId};
let mut logger = ProofLogger::create(Path::new("/tmp/proof.oxizlog"))
.expect("failed to create log");
logger.log_step(ProofNodeId(0), &ProofStep::Axiom {
conclusion: "true".to_string(),
}).expect("failed to log step");
logger.close().expect("failed to close log");Implementations§
Source§impl ProofLogger
impl ProofLogger
Sourcepub fn create(path: &Path) -> LoggingResult<Self>
pub fn create(path: &Path) -> LoggingResult<Self>
Create a new proof log at path, overwriting any existing file.
Writes the file header immediately.
Sourcepub fn append(path: &Path) -> LoggingResult<Self>
pub fn append(path: &Path) -> LoggingResult<Self>
Open an existing proof log for appending.
Does not write a new header; the file must already have a valid header
written by a previous ProofLogger::create call.
Sourcepub fn log_step(
&mut self,
node_id: ProofNodeId,
step: &ProofStep,
) -> LoggingResult<()>
pub fn log_step( &mut self, node_id: ProofNodeId, step: &ProofStep, ) -> LoggingResult<()>
Append a single ProofStep to the log.
node_id is the ProofNodeId assigned to this step in the live proof
DAG; it is recorded so that cross-references in Inference premises can
be resolved during replay.
§Errors
Returns LoggingError::AlreadyClosed if called after close().
Sourcepub fn flush(&mut self) -> LoggingResult<()>
pub fn flush(&mut self) -> LoggingResult<()>
Flush the internal write buffer to the OS.
Under normal operation you do not need to call this explicitly;
close() flushes before closing. Call flush() for crash-safety
checkpointing during long-running solves.
Sourcepub fn close(&mut self) -> LoggingResult<()>
pub fn close(&mut self) -> LoggingResult<()>
Flush and close the log file.
After this call, further log_step calls will return
LoggingError::AlreadyClosed.
Sourcepub fn step_count(&self) -> u64
pub fn step_count(&self) -> u64
Return the number of proof steps written since this logger was created.
Trait Implementations§
Source§impl Drop for ProofLogger
impl Drop for ProofLogger
Auto Trait Implementations§
impl Freeze for ProofLogger
impl RefUnwindSafe for ProofLogger
impl Send for ProofLogger
impl Sync for ProofLogger
impl Unpin for ProofLogger
impl UnsafeUnpin for ProofLogger
impl UnwindSafe for ProofLogger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more