pub struct Webview { /* private fields */ }Expand description
A Server started for a webview’s custom URI scheme: answers its
requests and holds the application. Clones share it.
ⓘ
const SCHEME: WebviewScheme = WebviewScheme::new("app");
let webview = Server::new("build").webview(SCHEME, 16 << 20).await?;
tauri::Builder::default()
.register_asynchronous_uri_scheme_protocol(SCHEME.name(), move |_, request, responder| {
let webview = webview.clone();
tauri::async_runtime::spawn(async move {
responder.respond(webview.respond(request).await);
});
})Implementations§
Source§impl Webview
impl Webview
Sourcepub async fn respond(&self, request: Request<Vec<u8>>) -> Response<Vec<u8>>
pub async fn respond(&self, request: Request<Vec<u8>>) -> Response<Vec<u8>>
The response to a webview request, from the build current when it arrives: Rust routes, then client assets, then the application.
Sourcepub fn router(&self) -> Router
pub fn router(&self) -> Router
The routes of the current build, for a host that answers its requests itself.
Sourcepub fn app(&self) -> AppHandle
pub fn app(&self) -> AppHandle
The application of the current build, whose named exports Rust can
call with AppHandle::call.
Sourcepub fn reloads(&self) -> Reloads
pub fn reloads(&self) -> Reloads
Each new build from now on, for the host to reload its window.
Ends immediately when started from an embedded artifact without
Server::dev_directory.
Sourcepub async fn shutdown(&self) -> Result<(), ServerError>
pub async fn shutdown(&self) -> Result<(), ServerError>
Shut the application down; requests after this fail.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Webview
impl !UnwindSafe for Webview
impl Forget for Webview
impl Freeze for Webview
impl Move for Webview
impl Send for Webview
impl Sync for Webview
impl Unpin for Webview
impl UnsafeUnpin for Webview
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
Mutably borrows from an owned value. Read more