pub trait Viewer {
// Required methods
fn open(
&mut self,
ctx: &Context,
bytes: &[u8],
path: &Path,
) -> Result<(), String>;
fn close(&mut self);
fn is_open(&self) -> bool;
fn title(&self) -> Option<String>;
fn central(&mut self, ui: &mut Ui, zoom: f32);
// Provided methods
fn side(&mut self, _ui: &mut Ui) -> bool { ... }
fn view_menu(&mut self, _ui: &mut Ui) { ... }
}Expand description
What the shell needs from the view that draws a particular format.
Required Methods§
Sourcefn open(
&mut self,
ctx: &Context,
bytes: &[u8],
path: &Path,
) -> Result<(), String>
fn open( &mut self, ctx: &Context, bytes: &[u8], path: &Path, ) -> Result<(), String>
Take a document’s bytes. The path is for the window’s title and for reloading, and is never read from here: this is given the bytes.
The context is for the work a new document makes necessary before it can be drawn — loading the font faces its styles name, which rebuilds egui’s glyph atlas and so belongs to opening rather than to drawing.
§Errors
A message to show the person, already translated.
Provided Methods§
Sourcefn side(&mut self, _ui: &mut Ui) -> bool
fn side(&mut self, _ui: &mut Ui) -> bool
Draw the panel beside the document — an outline, a sheet list, a slide list — and answer whether there is one to draw.
Add the application’s own items to the View menu.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".