pub struct WebView<'a, T: 'a> { /* private fields */ }
Expand description
An owned webview instance.
Construct via a WebViewBuilder
.
Implementations
sourceimpl<'a, T> WebView<'a, T>
impl<'a, T> WebView<'a, T>
sourcepub fn handle(&self) -> Handle<T>
pub fn handle(&self) -> Handle<T>
Creates a thread-safe Handle
to the WebView
, from which closures can be dispatched.
sourcepub fn user_data_mut(&mut self) -> &mut T
pub fn user_data_mut(&mut self) -> &mut T
Borrows the user data mutably.
sourcepub fn eval(&mut self, js: &str) -> WVResult
pub fn eval(&mut self, js: &str) -> WVResult
Executes the provided string as JavaScript code within the WebView
instance.
sourcepub fn inject_css(&mut self, css: &str) -> WVResult
pub fn inject_css(&mut self, css: &str) -> WVResult
Injects the provided string as CSS within the WebView
instance.
sourcepub fn set_color<C: Into<Color>>(&mut self, color: C)
pub fn set_color<C: Into<Color>>(&mut self, color: C)
Sets the color of the title bar.
Examples
Without specifying alpha (defaults to 255):
ⓘ
webview.set_color((123, 321, 213));
Specifying alpha:
ⓘ
webview.set_color((123, 321, 213, 127));
sourcepub fn set_title(&mut self, title: &str) -> WVResult
pub fn set_title(&mut self, title: &str) -> WVResult
Sets the title displayed at the top of the window.
Errors
If title
contain a nul byte, returns Error::NulByte
.
sourcepub fn set_fullscreen(&mut self, fullscreen: bool)
pub fn set_fullscreen(&mut self, fullscreen: bool)
Enables or disables fullscreen.
sourcepub fn dialog<'b>(&'b mut self) -> DialogBuilder<'a, 'b, T>
pub fn dialog<'b>(&'b mut self) -> DialogBuilder<'a, 'b, T>
Returns a builder for opening a new dialog window.
sourcepub fn step(&mut self) -> Option<WVResult>
pub fn step(&mut self) -> Option<WVResult>
Iterates the event loop. Returns None
if the view has been closed or terminated.
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the WebView
and returns ownership of the user data.
Trait Implementations
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for WebView<'a, T>where
T: RefUnwindSafe,
impl<'a, T> !Send for WebView<'a, T>
impl<'a, T> !Sync for WebView<'a, T>
impl<'a, T> Unpin for WebView<'a, T>
impl<'a, T> !UnwindSafe for WebView<'a, T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more