Rustfmt: use group_imports
This commit is contained in:
parent
936da131c2
commit
2665c12098
86 changed files with 225 additions and 276 deletions
|
|
@ -1,9 +1,10 @@
|
|||
use super::super::main_thread::MainThreadMarker;
|
||||
use super::{channel, Receiver, Sender, Wrapper};
|
||||
use std::cell::Ref;
|
||||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Condvar, Mutex};
|
||||
|
||||
use super::super::main_thread::MainThreadMarker;
|
||||
use super::{channel, Receiver, Sender, Wrapper};
|
||||
|
||||
pub struct Dispatcher<T: 'static>(Wrapper<T, Arc<Sender<Closure<T>>>, Closure<T>>);
|
||||
|
||||
struct Closure<T>(Box<dyn FnOnce(&T) + Send>);
|
||||
|
|
|
|||
|
|
@ -9,11 +9,12 @@ mod notifier;
|
|||
mod waker;
|
||||
mod wrapper;
|
||||
|
||||
use atomic_waker::AtomicWaker;
|
||||
use concurrent_queue::{ConcurrentQueue, PushError};
|
||||
|
||||
pub use self::abortable::{AbortHandle, Abortable, DropAbortHandle};
|
||||
pub use self::channel::{channel, Receiver, Sender};
|
||||
pub use self::dispatcher::{DispatchRunner, Dispatcher};
|
||||
pub use self::notifier::{Notified, Notifier};
|
||||
pub use self::waker::{Waker, WakerSpawner};
|
||||
use self::wrapper::Wrapper;
|
||||
use atomic_waker::AtomicWaker;
|
||||
use concurrent_queue::{ConcurrentQueue, PushError};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
use super::super::main_thread::MainThreadMarker;
|
||||
use std::cell::{Ref, RefCell};
|
||||
use std::future::Future;
|
||||
use std::marker::PhantomData;
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::super::main_thread::MainThreadMarker;
|
||||
|
||||
// Unsafe wrapper type that allows us to use `T` when it's not `Send` from other threads.
|
||||
// `value` **must** only be accessed on the main thread.
|
||||
pub struct Wrapper<V: 'static, S: Clone + Send, E> {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
use std::marker::PhantomData;
|
||||
|
||||
use super::{backend, device, window};
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::error::EventLoopError;
|
||||
use crate::event::Event;
|
||||
use crate::event_loop::ActiveEventLoop as RootActiveEventLoop;
|
||||
use crate::platform::web::{ActiveEventLoopExtWebSys, PollStrategy, WaitUntilStrategy};
|
||||
|
||||
use super::{backend, device, window};
|
||||
|
||||
mod proxy;
|
||||
pub(crate) mod runner;
|
||||
mod state;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,15 @@
|
|||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::{HashSet, VecDeque};
|
||||
use std::iter;
|
||||
use std::ops::Deref;
|
||||
use std::rc::{Rc, Weak};
|
||||
|
||||
use js_sys::Function;
|
||||
use wasm_bindgen::prelude::{wasm_bindgen, Closure};
|
||||
use wasm_bindgen::JsCast;
|
||||
use web_sys::{Document, KeyboardEvent, PageTransitionEvent, PointerEvent, WheelEvent};
|
||||
use web_time::{Duration, Instant};
|
||||
|
||||
use super::super::main_thread::MainThreadMarker;
|
||||
use super::super::DeviceId;
|
||||
use super::backend;
|
||||
|
|
@ -14,17 +26,6 @@ use crate::platform_impl::platform::r#async::{DispatchRunner, Waker, WakerSpawne
|
|||
use crate::platform_impl::platform::window::Inner;
|
||||
use crate::window::WindowId;
|
||||
|
||||
use js_sys::Function;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::{HashSet, VecDeque};
|
||||
use std::iter;
|
||||
use std::ops::Deref;
|
||||
use std::rc::{Rc, Weak};
|
||||
use wasm_bindgen::prelude::{wasm_bindgen, Closure};
|
||||
use wasm_bindgen::JsCast;
|
||||
use web_sys::{Document, KeyboardEvent, PageTransitionEvent, PointerEvent, WheelEvent};
|
||||
use web_time::{Duration, Instant};
|
||||
|
||||
pub struct Shared(Rc<Execution>);
|
||||
|
||||
pub(super) type EventHandler = dyn FnMut(Event);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use super::backend;
|
||||
|
||||
use web_time::Instant;
|
||||
|
||||
use super::backend;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum State {
|
||||
Init,
|
||||
|
|
|
|||
|
|
@ -31,20 +31,20 @@ mod monitor;
|
|||
mod web_sys;
|
||||
mod window;
|
||||
|
||||
pub(crate) use cursor::{
|
||||
CustomCursor as PlatformCustomCursor, CustomCursorFuture,
|
||||
CustomCursorSource as PlatformCustomCursorSource,
|
||||
};
|
||||
|
||||
pub use self::device::DeviceId;
|
||||
pub use self::error::OsError;
|
||||
pub(crate) use self::event_loop::{
|
||||
ActiveEventLoop, EventLoop, EventLoopProxy, OwnedDisplayHandle,
|
||||
PlatformSpecificEventLoopAttributes,
|
||||
};
|
||||
pub use self::monitor::{MonitorHandle, VideoModeHandle};
|
||||
pub use self::window::{PlatformSpecificWindowAttributes, Window, WindowId};
|
||||
|
||||
pub(crate) use self::keyboard::KeyEventExtra;
|
||||
pub use self::monitor::{MonitorHandle, VideoModeHandle};
|
||||
use self::web_sys as backend;
|
||||
pub use self::window::{PlatformSpecificWindowAttributes, Window, WindowId};
|
||||
pub(crate) use crate::icon::NoIcon as PlatformIcon;
|
||||
pub(crate) use crate::platform_impl::Fullscreen;
|
||||
pub(crate) use cursor::{
|
||||
CustomCursor as PlatformCustomCursor, CustomCursorFuture,
|
||||
CustomCursorSource as PlatformCustomCursorSource,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use std::cell::Cell;
|
||||
use std::rc::Rc;
|
||||
|
||||
use wasm_bindgen::closure::Closure;
|
||||
use wasm_bindgen::JsCast;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,13 +11,6 @@ use web_sys::{
|
|||
PointerEvent, WheelEvent,
|
||||
};
|
||||
|
||||
use crate::dpi::{LogicalPosition, PhysicalPosition, PhysicalSize};
|
||||
use crate::error::OsError as RootOE;
|
||||
use crate::event::{Force, InnerSizeWriter, MouseButton, MouseScrollDelta};
|
||||
use crate::keyboard::{Key, KeyLocation, ModifiersState, PhysicalKey};
|
||||
use crate::platform_impl::OsError;
|
||||
use crate::window::{WindowAttributes, WindowId as RootWindowId};
|
||||
|
||||
use super::super::cursor::CursorHandler;
|
||||
use super::super::main_thread::MainThreadMarker;
|
||||
use super::super::WindowId;
|
||||
|
|
@ -27,6 +20,12 @@ use super::intersection_handle::IntersectionObserverHandle;
|
|||
use super::media_query_handle::MediaQueryListHandle;
|
||||
use super::pointer::PointerHandler;
|
||||
use super::{event, fullscreen, ButtonsState, ResizeScaleHandle};
|
||||
use crate::dpi::{LogicalPosition, PhysicalPosition, PhysicalSize};
|
||||
use crate::error::OsError as RootOE;
|
||||
use crate::event::{Force, InnerSizeWriter, MouseButton, MouseScrollDelta};
|
||||
use crate::keyboard::{Key, KeyLocation, ModifiersState, PhysicalKey};
|
||||
use crate::platform_impl::OsError;
|
||||
use crate::window::{WindowAttributes, WindowId as RootWindowId};
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub struct Canvas {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
use crate::event::{MouseButton, MouseScrollDelta};
|
||||
use crate::keyboard::{Key, KeyLocation, ModifiersState, NamedKey, PhysicalKey};
|
||||
use std::cell::OnceCell;
|
||||
|
||||
use dpi::{LogicalPosition, PhysicalPosition, Position};
|
||||
use smol_str::SmolStr;
|
||||
use std::cell::OnceCell;
|
||||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
use wasm_bindgen::{JsCast, JsValue};
|
||||
use web_sys::{KeyboardEvent, MouseEvent, PointerEvent, WheelEvent};
|
||||
|
||||
use super::Engine;
|
||||
use crate::event::{MouseButton, MouseScrollDelta};
|
||||
use crate::keyboard::{Key, KeyLocation, ModifiersState, NamedKey, PhysicalKey};
|
||||
|
||||
bitflags::bitflags! {
|
||||
// https://www.w3.org/TR/pointerevents3/#the-buttons-property
|
||||
|
|
|
|||
|
|
@ -11,13 +11,6 @@ mod schedule;
|
|||
|
||||
use std::sync::OnceLock;
|
||||
|
||||
pub use self::canvas::{Canvas, Style};
|
||||
pub use self::event::ButtonsState;
|
||||
pub use self::event_handle::EventListenerHandle;
|
||||
pub use self::resize_scaling::ResizeScaleHandle;
|
||||
pub use self::schedule::Schedule;
|
||||
|
||||
use crate::dpi::{LogicalPosition, LogicalSize};
|
||||
use js_sys::Array;
|
||||
use wasm_bindgen::closure::Closure;
|
||||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
|
|
@ -26,6 +19,13 @@ use web_sys::{
|
|||
Document, HtmlCanvasElement, Navigator, PageTransitionEvent, VisibilityState, Window,
|
||||
};
|
||||
|
||||
pub use self::canvas::{Canvas, Style};
|
||||
pub use self::event::ButtonsState;
|
||||
pub use self::event_handle::EventListenerHandle;
|
||||
pub use self::resize_scaling::ResizeScaleHandle;
|
||||
pub use self::schedule::Schedule;
|
||||
use crate::dpi::{LogicalPosition, LogicalSize};
|
||||
|
||||
pub fn throw(msg: &str) {
|
||||
wasm_bindgen::throw_str(msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
use std::cell::Cell;
|
||||
use std::rc::Rc;
|
||||
|
||||
use event::ButtonsState;
|
||||
use web_sys::PointerEvent;
|
||||
|
||||
use super::canvas::Common;
|
||||
use super::event;
|
||||
use super::event_handle::EventListenerHandle;
|
||||
|
|
@ -8,9 +11,6 @@ use crate::dpi::PhysicalPosition;
|
|||
use crate::event::{Force, MouseButton};
|
||||
use crate::keyboard::ModifiersState;
|
||||
|
||||
use event::ButtonsState;
|
||||
use web_sys::PointerEvent;
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(super) struct PointerHandler {
|
||||
on_cursor_leave: Option<EventListenerHandle<dyn FnMut(PointerEvent)>>,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
use std::cell::{Cell, RefCell};
|
||||
use std::rc::Rc;
|
||||
|
||||
use js_sys::{Array, Object};
|
||||
use tracing::warn;
|
||||
use wasm_bindgen::prelude::{wasm_bindgen, Closure};
|
||||
|
|
@ -7,14 +10,10 @@ use web_sys::{
|
|||
ResizeObserverEntry, ResizeObserverOptions, ResizeObserverSize, Window,
|
||||
};
|
||||
|
||||
use crate::dpi::{LogicalSize, PhysicalSize};
|
||||
|
||||
use super::super::backend;
|
||||
use super::canvas::Style;
|
||||
use super::media_query_handle::MediaQueryListHandle;
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::rc::Rc;
|
||||
use crate::dpi::{LogicalSize, PhysicalSize};
|
||||
|
||||
pub struct ResizeScaleHandle(Rc<ResizeScaleInternal>);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use js_sys::{Array, Function, Object, Promise, Reflect};
|
||||
use std::cell::OnceCell;
|
||||
use std::time::Duration;
|
||||
|
||||
use js_sys::{Array, Function, Object, Promise, Reflect};
|
||||
use wasm_bindgen::closure::Closure;
|
||||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
use wasm_bindgen::{JsCast, JsValue};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,14 @@
|
|||
use std::cell::RefCell;
|
||||
use std::collections::VecDeque;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
use web_sys::HtmlCanvasElement;
|
||||
|
||||
use super::main_thread::{MainThreadMarker, MainThreadSafe};
|
||||
use super::monitor::MonitorHandle;
|
||||
use super::r#async::Dispatcher;
|
||||
use super::{backend, ActiveEventLoop, Fullscreen};
|
||||
use crate::dpi::{PhysicalPosition, PhysicalSize, Position, Size};
|
||||
use crate::error::{ExternalError, NotSupportedError, OsError as RootOE};
|
||||
use crate::icon::Icon;
|
||||
|
|
@ -6,17 +17,6 @@ use crate::window::{
|
|||
WindowAttributes, WindowButtons, WindowId as RootWI, WindowLevel,
|
||||
};
|
||||
|
||||
use super::main_thread::{MainThreadMarker, MainThreadSafe};
|
||||
use super::monitor::MonitorHandle;
|
||||
use super::r#async::Dispatcher;
|
||||
use super::{backend, ActiveEventLoop, Fullscreen};
|
||||
use web_sys::HtmlCanvasElement;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::collections::VecDeque;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Window {
|
||||
inner: Dispatcher<Inner>,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue