remove derive_more

This commit is contained in:
K Simmons 2022-10-25 00:06:43 -07:00
parent a725ded95e
commit 82956b618a
3 changed files with 39 additions and 47 deletions

39
Cargo.lock generated
View File

@ -1160,12 +1160,6 @@ dependencies = [
"theme",
]
[[package]]
name = "convert_case"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
[[package]]
name = "core-foundation"
version = "0.9.3"
@ -1578,19 +1572,6 @@ dependencies = [
"byteorder",
]
[[package]]
name = "derive_more"
version = "0.99.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
dependencies = [
"convert_case",
"proc-macro2",
"quote",
"rustc_version 0.4.0",
"syn",
]
[[package]]
name = "dhat"
version = "0.3.1"
@ -2407,7 +2388,6 @@ dependencies = [
"core-graphics",
"core-text",
"ctor",
"derive_more",
"dhat",
"env_logger",
"etagere",
@ -3965,7 +3945,7 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39fe46acc5503595e5949c17b818714d26fdf9b4920eacf3b2947f0199f4a6ff"
dependencies = [
"rustc_version 0.3.3",
"rustc_version",
]
[[package]]
@ -4917,16 +4897,7 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee"
dependencies = [
"semver 0.11.0",
]
[[package]]
name = "rustc_version"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [
"semver 1.0.14",
"semver",
]
[[package]]
@ -5181,12 +5152,6 @@ dependencies = [
"semver-parser",
]
[[package]]
name = "semver"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4"
[[package]]
name = "semver-parser"
version = "0.10.2"

View File

@ -20,7 +20,6 @@ sum_tree = { path = "../sum_tree" }
async-task = "4.0.3"
backtrace = { version = "0.3", optional = true }
ctor = "0.1"
derive_more = "0.99.17"
dhat = { version = "0.3", optional = true }
env_logger = { version = "0.9", optional = true }
etagere = "0.2"

View File

@ -1,4 +1,4 @@
use derive_more::Deref;
use std::ops::Deref;
use crate::{geometry::vector::Vector2F, keymap::Keystroke};
@ -22,12 +22,19 @@ pub struct Modifiers {
pub fun: bool,
}
#[derive(Clone, Copy, Debug, Default, Deref)]
#[derive(Clone, Copy, Debug, Default)]
pub struct ModifiersChangedEvent {
#[deref]
pub modifiers: Modifiers,
}
impl Deref for ModifiersChangedEvent {
type Target = Modifiers;
fn deref(&self) -> &Self::Target {
&self.modifiers
}
}
/// The phase of a touch motion event.
/// Based on the winit enum of the same name,
#[derive(Clone, Copy, Debug)]
@ -37,17 +44,24 @@ pub enum TouchPhase {
Ended,
}
#[derive(Clone, Copy, Debug, Default, Deref)]
#[derive(Clone, Copy, Debug, Default)]
pub struct ScrollWheelEvent {
pub position: Vector2F,
pub delta: Vector2F,
pub precise: bool,
#[deref]
pub modifiers: Modifiers,
/// If the platform supports returning the phase of a scroll wheel event, it will be stored here
pub phase: Option<TouchPhase>,
}
impl Deref for ScrollWheelEvent {
type Target = Modifiers;
fn deref(&self) -> &Self::Target {
&self.modifiers
}
}
#[derive(Hash, PartialEq, Eq, Copy, Clone, Debug)]
pub enum NavigationDirection {
Back,
@ -86,23 +100,37 @@ impl Default for MouseButton {
}
}
#[derive(Clone, Copy, Debug, Default, Deref)]
#[derive(Clone, Copy, Debug, Default)]
pub struct MouseButtonEvent {
pub button: MouseButton,
pub position: Vector2F,
#[deref]
pub modifiers: Modifiers,
pub click_count: usize,
}
#[derive(Clone, Copy, Debug, Default, Deref)]
impl Deref for MouseButtonEvent {
type Target = Modifiers;
fn deref(&self) -> &Self::Target {
&self.modifiers
}
}
#[derive(Clone, Copy, Debug, Default)]
pub struct MouseMovedEvent {
pub position: Vector2F,
pub pressed_button: Option<MouseButton>,
#[deref]
pub modifiers: Modifiers,
}
impl Deref for MouseMovedEvent {
type Target = Modifiers;
fn deref(&self) -> &Self::Target {
&self.modifiers
}
}
impl MouseMovedEvent {
pub fn to_button_event(&self, button: MouseButton) -> MouseButtonEvent {
MouseButtonEvent {