Skip to main content

Viewer

Struct Viewer 

Source
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

Source

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).

Source

pub fn set_embed_backend(&self, backend: Option<Arc<dyn EmbedBackend>>)

Replaces what opens web views (none: YouTube links open outside).

Source

pub fn embed_reopen(&self, app: &AppHandle)

Opens again the web view whose own window the user closed.

Source§

impl Viewer

Source

pub fn plays_video(&self) -> bool

Whether local video files open here: a backend is there.

Source

pub fn video_toggle(&self, app: &AppHandle) -> Result<Json, String>

Plays or pauses; from the end, plays from the start.

Source

pub fn video_seek_to( &self, app: &AppHandle, seconds: f64, ) -> Result<Json, String>

Moves to a position, kept within the video.

Source

pub fn video_seek_by( &self, app: &AppHandle, seconds: f64, ) -> Result<Json, String>

Moves the position forward, or back with a negative number.

Source

pub fn video_volume(&self, app: &AppHandle, volume: f32) -> Result<Json, String>

Sets the volume, from 0 to 1, kept for the session’s next videos.

Source

pub fn video_volume_by(&self, app: &AppHandle, by: f32) -> Result<Json, String>

Changes the volume by an amount.

Source§

impl Viewer

Source

pub fn new(docs: Docs, fetch: Option<Arc<dyn Fetch>>) -> Self

Source

pub fn set_video_backend(&self, backend: Option<Arc<dyn VideoBackend>>)

Replaces what plays local videos (none: they open outside).

Source

pub fn docs(&self) -> &Docs

The pages the application ships.

Source

pub fn target(&self) -> Option<String>

The page’s address with its anchor, if any.

Source

pub fn status(&self) -> Status

Where it is.

Source

pub fn zoom(&self) -> f32

The page’s zoom.

Source

pub fn navigate(&self, app: &AppHandle, target: &str, push: bool)

Opens a target in the viewer, as the links service does once the policy agreed (push: as a new page of the history).

Source

pub fn allowed_hosts(&self, app: &AppHandle) -> BTreeSet<String>

The hosts the user allowed images from (the setting).

Source

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).

Source

pub fn poll(&self, app: &AppHandle)

Takes what fetches brought (each pass).

Source

pub fn back(&self, app: &AppHandle) -> bool

The previous page.

Source

pub fn forward(&self, app: &AppHandle) -> bool

The next page.

Source

pub fn reload(&self, app: &AppHandle) -> bool

The page again (its remote images fetched again too).

Source

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.

Source

pub fn find_step(&self, next: bool) -> Option<usize>

The next (or previous) match, around the page; its number from 1, none without matches.

Source

pub fn close_find(&self)

Closes the search.

Source

pub fn zoom_step(&self, by: i32) -> f32

Moves the zoom by steps (0: back to 100%); returns it.

Source

pub fn open_outside( &self, app: &AppHandle, origin: &Origin, ) -> Result<Json, String>

Opens the page outside (a docs: page’s online copy).

Copies the page’s address.

Source

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.

Source

pub fn go(&self, app: &AppHandle, typed: &str)

Opens what the user typed in the address bar: an address, or a docs: page by its name.

Source

pub fn state(&self) -> Json

What the viewer shows and holds, for agents and the collector.

Trait Implementations§

Source§

impl Debug for Viewer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,