Enum broot::preview::Preview [−][src]
pub enum Preview {
Image(ImageView),
Syntactic(SyntacticView),
Hex(HexView),
ZeroLen(ZeroLenFileView),
IoError(Error),
}
Variants
Image(ImageView)
Tuple Fields of Image
0: ImageView
Syntactic(SyntacticView)
Tuple Fields of Syntactic
Hex(HexView)
Tuple Fields of Hex
0: HexView
ZeroLen(ZeroLenFileView)
Tuple Fields of ZeroLen
IoError(Error)
Tuple Fields of IoError
0: Error
Implementations
build a preview, never failing (but the preview can be Preview::IOError). If the prefered mode can’t be applied, an other mode is chosen.
pub fn with_mode(
path: &Path,
mode: PreviewMode,
con: &AppContext
) -> Result<Self, ProgramError>
pub fn with_mode(
path: &Path,
mode: PreviewMode,
con: &AppContext
) -> Result<Self, ProgramError>
try to build a preview with the designed mode, return an error if that wasn’t possible
build an image view, unless the file can’t be interpreted as an image, in which case a hex view is used
build a text preview (maybe with syntaxic coloring) if possible, a hex (binary) view if content isnt’t UTF8, a ZeroLen file if there’s no length (it’s probably a linux pseudofile) or a IOError when there’s a IO problem
pub fn filtered(
&self,
path: &Path,
pattern: InputPattern,
dam: &mut Dam,
con: &AppContext
) -> Option<Self>
pub fn filtered(
&self,
path: &Path,
pattern: InputPattern,
dam: &mut Dam,
con: &AppContext
) -> Option<Self>
try to build a filtered text view. Will return None if the dam gets an event before it’s built
return a hex_view, suitable for binary, or Self::IOError if there was an error
return the preview_mode, or None if we’re on IOError