use crate::global_state::error::Error as GlobalStateError;
pub struct FlushRequest {}
impl FlushRequest {
pub fn new() -> Self {
FlushRequest {}
}
}
impl Default for FlushRequest {
fn default() -> Self {
FlushRequest::new()
}
}
pub enum FlushResult {
ManualSyncDisabled,
Success,
Failure(GlobalStateError),
}
impl FlushResult {
pub fn flushed(&self) -> bool {
matches!(self, FlushResult::Success)
}
pub fn as_error(self) -> Result<(), GlobalStateError> {
match self {
FlushResult::ManualSyncDisabled | FlushResult::Success => Ok(()),
FlushResult::Failure(gse) => Err(gse),
}
}
}