pub struct Viewer { /* private fields */ }Expand description
The viewer: its pages, history, search, zoom and images. Its methods are what its commands and its panel do.
Implementations§
Source§impl Viewer
impl Viewer
Sourcepub fn plays_web_video(&self) -> bool
pub fn plays_web_video(&self) -> bool
Whether YouTube links open here: a web view backend is there, and a
Referer naming the application (its id, or
ViewerPlugin::embed_referrer).
Sourcepub fn set_embed_backend(&self, backend: Option<Arc<dyn EmbedBackend>>)
pub fn set_embed_backend(&self, backend: Option<Arc<dyn EmbedBackend>>)
Replaces what opens web views (none: YouTube links open outside).
Sourcepub fn embed_reopen(&self, app: &AppHandle)
pub fn embed_reopen(&self, app: &AppHandle)
Opens again the web view whose own window the user closed.
Source§impl Viewer
impl Viewer
Sourcepub fn plays_video(&self) -> bool
pub fn plays_video(&self) -> bool
Whether local video files open here: a backend is there.
Sourcepub fn video_toggle(&self, app: &AppHandle) -> Result<Json, String>
pub fn video_toggle(&self, app: &AppHandle) -> Result<Json, String>
Plays or pauses; from the end, plays from the start.
Sourcepub fn video_seek_to(
&self,
app: &AppHandle,
seconds: f64,
) -> Result<Json, String>
pub fn video_seek_to( &self, app: &AppHandle, seconds: f64, ) -> Result<Json, String>
Moves to a position, kept within the video.
Sourcepub fn video_seek_by(
&self,
app: &AppHandle,
seconds: f64,
) -> Result<Json, String>
pub fn video_seek_by( &self, app: &AppHandle, seconds: f64, ) -> Result<Json, String>
Moves the position forward, or back with a negative number.
Source§impl Viewer
impl Viewer
pub fn new(docs: Docs, fetch: Option<Arc<dyn Fetch>>) -> Self
Sourcepub fn set_video_backend(&self, backend: Option<Arc<dyn VideoBackend>>)
pub fn set_video_backend(&self, backend: Option<Arc<dyn VideoBackend>>)
Replaces what plays local videos (none: they open outside).
Opens a target in the viewer, as the links service does once the
policy agreed (push: as a new page of the history).
Sourcepub fn allowed_hosts(&self, app: &AppHandle) -> BTreeSet<String>
pub fn allowed_hosts(&self, app: &AppHandle) -> BTreeSet<String>
The hosts the user allowed images from (the setting).
Sourcepub fn load_images(&self, app: &AppHandle, host: &str) -> Result<usize, String>
pub fn load_images(&self, app: &AppHandle, host: &str) -> Result<usize, String>
Loads the images waiting for a host and remembers the host (the user’s choice: kept from agents).
Sourcepub fn reload(&self, app: &AppHandle) -> bool
pub fn reload(&self, app: &AppHandle) -> bool
The page again (its remote images fetched again too).
Sourcepub fn find(&self, query: Option<&str>) -> usize
pub fn find(&self, query: Option<&str>) -> usize
Opens the search (query: searches it and goes to its first
match); returns the number of matches.
Sourcepub fn find_step(&self, next: bool) -> Option<usize>
pub fn find_step(&self, next: bool) -> Option<usize>
The next (or previous) match, around the page; its number from 1, none without matches.
Sourcepub fn close_find(&self)
pub fn close_find(&self)
Closes the search.
Sourcepub fn open_outside(
&self,
app: &AppHandle,
origin: &Origin,
) -> Result<Json, String>
pub fn open_outside( &self, app: &AppHandle, origin: &Origin, ) -> Result<Json, String>
Opens the page outside (a docs: page’s online copy).
Sourcepub fn copy_link(
&self,
app: &AppHandle,
origin: &Origin,
) -> Result<Json, String>
pub fn copy_link( &self, app: &AppHandle, origin: &Origin, ) -> Result<Json, String>
Copies the page’s address.
Sourcepub fn follow(&self, app: &AppHandle, dest: &str, outside: bool)
pub fn follow(&self, app: &AppHandle, dest: &str, outside: bool)
Follows a link of the page shown (dest as written), outside when
asked: an anchor scrolls, the rest goes through the links service.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Viewer
impl !RefUnwindSafe for Viewer
impl Send for Viewer
impl Sync for Viewer
impl Unpin for Viewer
impl UnsafeUnpin for Viewer
impl !UnwindSafe for Viewer
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more