verso

Struct VersoviewController

Source
pub struct VersoviewController { /* private fields */ }

Implementations§

Source§

impl VersoviewController

Source

pub fn new(verso_path: impl AsRef<Path>, initial_url: Url) -> Self

Create a new verso instance with default settings and get the controller to it

Source

pub fn exit(&self) -> Result<(), Box<ErrorKind>>

Exit

Source

pub fn on_close_requested( &self, callback: impl Fn() + Send + 'static, ) -> Result<(), Box<ErrorKind>>

Listen on close requested from the OS, if you decide to use it, verso will not close the window by itself anymore, so make sure you handle it properly by either do your own logic or call Self::exit as a fallback

Source

pub fn execute_script(&self, script: String) -> Result<(), Box<ErrorKind>>

Execute script

Source

pub fn navigate(&self, url: Url) -> Result<(), Box<ErrorKind>>

Navigate to url

Source

pub fn on_navigation_starting( &self, callback: impl Fn(Url) -> bool + Send + 'static, ) -> Result<(), Box<ErrorKind>>

Listen on navigation starting triggered by user click on a link, return a boolean in the callback to decide whether or not allowing this navigation

Source

pub fn on_web_resource_requested( &self, callback: impl Fn(WebResourceRequest, Box<dyn FnOnce(Option<Response<Vec<u8>>>) + Send>) + Send + 'static, ) -> Result<(), Box<ErrorKind>>

Listen on web resource requests, return a boolean in the callback to decide whether or not allowing this navigation

Source

pub fn set_size<S: Into<Size>>(&self, size: S) -> Result<(), Box<ErrorKind>>

Sets the webview window’s size

Source

pub fn set_position<P: Into<Position>>( &self, position: P, ) -> Result<(), Box<ErrorKind>>

Sets the webview window’s position

Source

pub fn set_maximized(&self, maximized: bool) -> Result<(), Box<ErrorKind>>

Maximize or unmaximize the window

Source

pub fn set_minimized(&self, minimized: bool) -> Result<(), Box<ErrorKind>>

Minimize or unminimize the window

Source

pub fn set_fullscreen(&self, fullscreen: bool) -> Result<(), Box<ErrorKind>>

Sets the window to fullscreen or back

Source

pub fn set_visible(&self, visible: bool) -> Result<(), Box<ErrorKind>>

Show or hide the window

Source

pub fn start_dragging(&self) -> Result<(), Box<ErrorKind>>

Moves the window with the left mouse button until the button is released

Source

pub fn get_size(&self) -> Result<PhysicalSize<u32>, Box<ErrorKind>>

Get the window’s size

Source

pub fn get_position( &self, ) -> Result<Option<PhysicalPosition<i32>>, Box<ErrorKind>>

Get the window’s position, returns None on unsupported platforms (currently only Wayland)

Source

pub fn is_maximized(&self) -> Result<bool, Box<ErrorKind>>

Get if the window is currently maximized or not

Source

pub fn is_minimized(&self) -> Result<bool, Box<ErrorKind>>

Get if the window is currently minimized or not

Source

pub fn is_fullscreen(&self) -> Result<bool, Box<ErrorKind>>

Get if the window is currently fullscreen or not

Source

pub fn is_visible(&self) -> Result<bool, Box<ErrorKind>>

Get the visibility of the window

Source

pub fn get_scale_factor(&self) -> Result<f64, Box<ErrorKind>>

Get the scale factor of the window

Source

pub fn get_current_url(&self) -> Result<Url, Box<ErrorKind>>

Get the URL of the webview

Trait Implementations§

Source§

impl Drop for VersoviewController

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T