mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-10 06:34:20 +00:00
Make clippy happy
This commit is contained in:
parent
cbed09b95c
commit
bc857bf339
9 changed files with 20 additions and 14 deletions
|
@ -6,13 +6,13 @@ This calculator version uses React-style state management. All state is held as
|
|||
use dioxus::events::*;
|
||||
use dioxus::html::input_data::keyboard_types::Key;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_desktop::{Config, WindowBuilder};
|
||||
use dioxus_desktop::{Config, LogicalSize, WindowBuilder};
|
||||
|
||||
fn main() {
|
||||
let config = Config::new().with_window(
|
||||
WindowBuilder::default()
|
||||
.with_title("Calculator")
|
||||
.with_inner_size(dioxus_desktop::LogicalSize::new(300.0, 500.0)),
|
||||
.with_inner_size(LogicalSize::new(300.0, 500.0)),
|
||||
);
|
||||
|
||||
dioxus_desktop::launch_cfg(app, config);
|
||||
|
|
|
@ -21,7 +21,7 @@ use dioxus::events::*;
|
|||
use dioxus::html::input_data::keyboard_types::Key;
|
||||
use dioxus::html::MouseEvent;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_desktop::wry::application::dpi::LogicalSize;
|
||||
use dioxus_desktop::tao::dpi::LogicalSize;
|
||||
use dioxus_desktop::{Config, WindowBuilder};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use dioxus::prelude::*;
|
||||
use dioxus_desktop::tao::event::Event as WryEvent;
|
||||
use dioxus_desktop::tao::event::WindowEvent;
|
||||
use dioxus_desktop::use_wry_event_handler;
|
||||
use dioxus_desktop::wry::application::event::Event as WryEvent;
|
||||
use dioxus_desktop::{Config, WindowCloseBehaviour};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -87,6 +87,7 @@ impl<P: 'static> App<P> {
|
|||
// Set the event converter
|
||||
dioxus_html::set_event_converter(Box::new(SerializedHtmlEventConverter));
|
||||
|
||||
// Allow hotreloading to work - but only in debug mode
|
||||
#[cfg(all(feature = "hot-reload", debug_assertions))]
|
||||
app.connect_hotreload();
|
||||
|
||||
|
|
|
@ -102,13 +102,14 @@ impl DesktopService {
|
|||
|
||||
/// Send a list of mutations to the webview
|
||||
pub(crate) fn send_edits(&self, edits: Mutations) {
|
||||
crate::edits::apply_edits(
|
||||
if let Some(bytes) = crate::edits::apply_edits(
|
||||
edits,
|
||||
&mut self.channel.borrow_mut(),
|
||||
&mut self.templates.borrow_mut(),
|
||||
&self.max_template_count,
|
||||
)
|
||||
.map(|bytes| self.edit_queue.add_edits(bytes));
|
||||
) {
|
||||
self.edit_queue.add_edits(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a new window using the props and window builder
|
||||
|
|
|
@ -32,6 +32,9 @@ mod launch;
|
|||
|
||||
// Reexport tao and wry, might want to re-export other important things
|
||||
pub use tao;
|
||||
pub use tao::dpi::{LogicalPosition, LogicalSize};
|
||||
pub use tao::event::WindowEvent;
|
||||
pub use tao::window::WindowBuilder;
|
||||
pub use wry;
|
||||
|
||||
// Public exports
|
||||
|
|
|
@ -11,6 +11,8 @@ use wry::{
|
|||
static MINIFIED: &str = include_str!("./minified.js");
|
||||
static DEFAULT_INDEX: &str = include_str!("./index.html");
|
||||
|
||||
// todo: clean this up a bit
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(super) async fn desktop_handler(
|
||||
request: Request<Vec<u8>>,
|
||||
custom_head: Option<String>,
|
||||
|
@ -107,7 +109,7 @@ fn build_index_file(
|
|||
Response::builder()
|
||||
.header("Content-Type", "text/html")
|
||||
.header("Access-Control-Allow-Origin", "*")
|
||||
.body(index.into_bytes().into())
|
||||
.body(index.into())
|
||||
}
|
||||
|
||||
/// Construct the inline script that boots up the page and bridges the webview with rust code.
|
||||
|
@ -136,10 +138,10 @@ fn module_loader(root_id: &str, headless: bool) -> String {
|
|||
)
|
||||
}
|
||||
|
||||
//// Get the assset directory, following tauri/cargo-bundles directory discovery approach
|
||||
////
|
||||
//// Defaults to the current directory if no asset directory is found, which is useful for development when the app
|
||||
//// isn't bundled.
|
||||
/// Get the assset directory, following tauri/cargo-bundles directory discovery approach
|
||||
///
|
||||
/// Defaults to the current directory if no asset directory is found, which is useful for development when the app
|
||||
/// isn't bundled.
|
||||
fn get_asset_root_or_default() -> PathBuf {
|
||||
get_asset_root().unwrap_or_else(|| Path::new(".").to_path_buf())
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ impl WebviewInstance {
|
|||
}
|
||||
|
||||
for (name, handler) in cfg.protocols.drain(..) {
|
||||
webview = webview.with_custom_protocol(name, move |r| handler(r))
|
||||
webview = webview.with_custom_protocol(name, handler);
|
||||
}
|
||||
|
||||
const INITIALIZATION_SCRIPT: &str = r#"
|
||||
|
|
|
@ -49,7 +49,6 @@ use crate::prelude::{Navigator, RouterContext};
|
|||
/// # let _ = vdom.rebuild();
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[deprecated = "Prefer acquiring the router directly with `dioxus_router::router()`"]
|
||||
pub fn use_navigator(cx: &ScopeState) -> &Navigator {
|
||||
&*cx.use_hook(|| {
|
||||
let router = cx
|
||||
|
|
Loading…
Reference in a new issue