Apply rustfmt

This commit is contained in:
zxey
2020-03-15 02:27:00 +01:00
parent 9e7a3e9cd5
commit 8f1f391a92
4 changed files with 30 additions and 17 deletions

View File

@@ -13,7 +13,7 @@ fn main() {
.invoke_handler(|webview, arg| {
match arg {
"exit" => webview.exit(),
_ => ()
_ => (),
}
Ok(())
})

View File

@@ -3,7 +3,9 @@ use tfd::MessageBoxIcon;
use {WVResult, WebView};
/// A builder for opening a new dialog window.
#[deprecated(note = "Please use crates like 'tinyfiledialogs' for dialog handling, see example in examples/dialog.rs")]
#[deprecated(
note = "Please use crates like 'tinyfiledialogs' for dialog handling, see example in examples/dialog.rs"
)]
#[derive(Debug)]
pub struct DialogBuilder<'a: 'b, 'b, T: 'a> {
webview: &'b mut WebView<'a, T>,

View File

@@ -24,9 +24,9 @@
#![allow(deprecated)] // TODO: remove this when removing dialogs
extern crate boxfnonce;
extern crate tinyfiledialogs as tfd;
extern crate urlencoding;
extern crate webview_sys as ffi;
extern crate tinyfiledialogs as tfd;
mod color;
mod dialog;
@@ -188,7 +188,7 @@ where
self
}
/// The window crated will be frameless
///
///
/// defaults to `false`
pub fn frameless(mut self, frameless: bool) -> Self {
self.frameless = frameless;
@@ -437,9 +437,10 @@ impl<'a, T> WebView<'a, T> {
unsafe { webview_set_fullscreen(self.inner, fullscreen as _) };
}
/// Returns a builder for opening a new dialog window.
#[deprecated(note = "Please use crates like 'tinyfiledialogs' for dialog handling, see example in examples/dialog.rs")]
#[deprecated(
note = "Please use crates like 'tinyfiledialogs' for dialog handling, see example in examples/dialog.rs"
)]
pub fn dialog<'b>(&'b mut self) -> DialogBuilder<'a, 'b, T> {
DialogBuilder::new(self)
}

View File

@@ -15,15 +15,25 @@ pub enum CWebView {} // opaque type, only used in ffi pointers
type ErasedExternalInvokeFn = extern "C" fn(webview: *mut CWebView, arg: *const c_char);
type ErasedDispatchFn = extern "C" fn(webview: *mut CWebView, arg: *mut c_void);
extern {
pub fn webview_free(this: *mut CWebView);
pub fn webview_new(title: *const c_char, url: *const c_char, width: c_int, height: c_int, resizable: c_int, debug: c_int, frameless: c_int, external_invoke_cb: Option<ErasedExternalInvokeFn>, userdata: *mut c_void) -> *mut CWebView;
pub fn webview_loop(this: *mut CWebView, blocking: c_int) -> c_int;
pub fn webview_exit(this: *mut CWebView);
pub fn webview_get_user_data(this: *mut CWebView) -> *mut c_void;
pub fn webview_dispatch(this: *mut CWebView, f: Option<ErasedDispatchFn>, arg: *mut c_void);
pub fn webview_eval(this: *mut CWebView, js: *const c_char) -> c_int;
pub fn webview_set_title(this: *mut CWebView, title: *const c_char);
pub fn webview_set_fullscreen(this: *mut CWebView, fullscreen: c_int);
pub fn webview_set_color(this: *mut CWebView, red: u8, green: u8, blue: u8, alpha: u8);
extern "C" {
pub fn webview_free(this: *mut CWebView);
pub fn webview_new(
title: *const c_char,
url: *const c_char,
width: c_int,
height: c_int,
resizable: c_int,
debug: c_int,
frameless: c_int,
external_invoke_cb: Option<ErasedExternalInvokeFn>,
userdata: *mut c_void,
) -> *mut CWebView;
pub fn webview_loop(this: *mut CWebView, blocking: c_int) -> c_int;
pub fn webview_exit(this: *mut CWebView);
pub fn webview_get_user_data(this: *mut CWebView) -> *mut c_void;
pub fn webview_dispatch(this: *mut CWebView, f: Option<ErasedDispatchFn>, arg: *mut c_void);
pub fn webview_eval(this: *mut CWebView, js: *const c_char) -> c_int;
pub fn webview_set_title(this: *mut CWebView, title: *const c_char);
pub fn webview_set_fullscreen(this: *mut CWebView, fullscreen: c_int);
pub fn webview_set_color(this: *mut CWebView, red: u8, green: u8, blue: u8, alpha: u8);
}