pub enum ContentCheck {
Sha256(String),
Magic {
prefixes: Vec<Vec<u8>>,
trim_leading_whitespace: bool,
},
MinBytes(u64),
NotHtml,
Custom(Arc<dyn Fn(&[u8]) -> Result<(), String> + Send + Sync>),
All(Vec<ContentCheck>),
None,
}Variants§
Sha256(String)
Magic
MinBytes(u64)
NotHtml
Custom(Arc<dyn Fn(&[u8]) -> Result<(), String> + Send + Sync>)
All(Vec<ContentCheck>)
None
Implementations§
Source§impl ContentCheck
impl ContentCheck
pub fn magic(prefixes: Vec<Vec<u8>>, trim_leading_whitespace: bool) -> Self
pub fn custom(f: Arc<dyn Fn(&[u8]) -> Result<(), String> + Send + Sync>) -> Self
pub fn default_binary() -> Self
pub fn check(&self, bytes: &[u8]) -> Result<(), CheckFailure>
Sourcepub fn check_prefix(&self, head: &[u8]) -> Result<(), CheckFailure>
pub fn check_prefix(&self, head: &[u8]) -> Result<(), CheckFailure>
Reject a wrong signature or HTML before downloading the remaining body.
Inconclusive short prefixes pass; check_file remains authoritative.
Sourcepub fn check_file(&self, path: &Path) -> Result<(), CheckFailure>
pub fn check_file(&self, path: &Path) -> Result<(), CheckFailure>
Built-in checks stream files; only a custom predicate loads the full body.
Trait Implementations§
Source§impl Clone for ContentCheck
impl Clone for ContentCheck
Auto Trait Implementations§
impl !RefUnwindSafe for ContentCheck
impl !UnwindSafe for ContentCheck
impl Freeze for ContentCheck
impl Send for ContentCheck
impl Sync for ContentCheck
impl Unpin for ContentCheck
impl UnsafeUnpin for ContentCheck
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
Mutably borrows from an owned value. Read more