use super::{
BtCheckIntegrity, IntegrityFinishedAction, IntegrityIncompleteAction,
IntegrityTrailingGarbageAction, StreamCheckIntegrity,
};
#[derive(Debug)]
pub enum CheckIntegrityKind {
Stream(StreamCheckIntegrity),
Bt(BtCheckIntegrity),
}
impl CheckIntegrityKind {
pub fn is_validation_ready(&self) -> bool {
match self {
CheckIntegrityKind::Stream(s) => s.is_validation_ready(),
CheckIntegrityKind::Bt(b) => b.is_validation_ready(),
}
}
pub fn init_validator(&mut self) {
match self {
CheckIntegrityKind::Stream(s) => s.init_validator(),
CheckIntegrityKind::Bt(b) => b.init_validator(),
}
}
pub fn validate_chunk(&mut self) {
match self {
CheckIntegrityKind::Stream(s) => s.validate_chunk(),
CheckIntegrityKind::Bt(b) => b.validate_chunk(),
}
}
pub fn is_finished(&self) -> bool {
match self {
CheckIntegrityKind::Stream(s) => s.is_finished(),
CheckIntegrityKind::Bt(b) => b.is_finished(),
}
}
pub fn total_length(&self) -> u64 {
match self {
CheckIntegrityKind::Stream(s) => s.total_length(),
CheckIntegrityKind::Bt(b) => b.total_length(),
}
}
pub fn current_length(&self) -> u64 {
match self {
CheckIntegrityKind::Stream(s) => s.current_length(),
CheckIntegrityKind::Bt(b) => b.current_length(),
}
}
pub fn on_download_finished(&self) -> IntegrityFinishedAction {
match self {
CheckIntegrityKind::Stream(s) => s.on_download_finished(),
CheckIntegrityKind::Bt(b) => b.on_download_finished(),
}
}
pub fn on_download_incomplete(&self) -> IntegrityIncompleteAction {
match self {
CheckIntegrityKind::Stream(s) => s.on_download_incomplete(),
CheckIntegrityKind::Bt(b) => b.on_download_incomplete(),
}
}
pub fn cut_trailing_garbage(&self) -> IntegrityTrailingGarbageAction {
match self {
CheckIntegrityKind::Stream(s) => s.cut_trailing_garbage(),
CheckIntegrityKind::Bt(b) => b.cut_trailing_garbage(),
}
}
pub fn should_report_incomplete_as_error(&self) -> bool {
match self {
CheckIntegrityKind::Stream(s) => s.should_report_incomplete_as_error(),
CheckIntegrityKind::Bt(b) => b.should_report_incomplete_as_error(),
}
}
}