pub enum MediaKind {
Text,
Image {
format: String,
},
Document {
pages: u32,
has_text_layer: bool,
},
Binary,
}Expand description
What kind of thing a handle refers to, reported by Event::Opened.
A block needs this to know which commands are worth issuing: Command::Slice
on a PNG is a mistake, and Command::PageText on a plain text file is
meaningless. Reporting it up front means a block can branch on what it
actually got rather than guessing from a file extension.
Variants§
Text
Valid UTF-8. Both Command::Slice and Command::SliceBytes work.
Image
An image the host recognised. Usable as an Command::Infer image.
Document
A paged document — a PDF, say.
Fields
has_text_layer: boolWhether it carries an extractable text layer.
False for a scanned document, where the only way to read it is to rasterize pages and hand them to a vision model. A block that checks this can pick the cheap path when it exists and the expensive one when it must, instead of silently extracting nothing.
Binary
Bytes the host could not classify. Only Command::SliceBytes applies.