use bornera_core::{ConnectionEpoch, OperationId, OperationOutcome};
use calandria::{Retained, RetainedBytes};
#[derive(Clone, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub struct EngineOutcome<F> {
epoch: ConnectionEpoch,
operation: OperationId,
outcome: OperationOutcome<F>,
}
impl<F> EngineOutcome<F> {
pub(crate) const fn new(
epoch: ConnectionEpoch,
operation: OperationId,
outcome: OperationOutcome<F>,
) -> Self {
Self {
epoch,
operation,
outcome,
}
}
pub const fn epoch(&self) -> ConnectionEpoch {
self.epoch
}
pub const fn operation(&self) -> OperationId {
self.operation
}
pub const fn outcome(&self) -> &OperationOutcome<F> {
&self.outcome
}
pub fn into_outcome(self) -> OperationOutcome<F> {
self.outcome
}
}
impl<F: Retained> Retained for EngineOutcome<F> {
fn retained_bytes(&self) -> RetainedBytes {
self.outcome.retained_bytes()
}
}