-
-
Notifications
You must be signed in to change notification settings - Fork 215
/
Copy pathserde_objects.rs
42 lines (36 loc) · 1.08 KB
/
serde_objects.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2014-2021 The winit contributors
// Copyright 2021-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
#![cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use tao::{
dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize},
event::{ElementState, MouseButton, MouseScrollDelta, TouchPhase},
keyboard::{Key, KeyCode, KeyLocation, ModifiersState},
window::CursorIcon,
};
#[allow(dead_code)]
fn needs_serde<S: Serialize + Deserialize<'static>>() {}
#[test]
fn window_serde() {
needs_serde::<CursorIcon>();
}
#[test]
fn events_serde() {
needs_serde::<TouchPhase>();
needs_serde::<ElementState>();
needs_serde::<MouseButton>();
needs_serde::<MouseScrollDelta>();
needs_serde::<Key>();
needs_serde::<KeyCode>();
needs_serde::<KeyLocation>();
needs_serde::<ModifiersState>();
}
#[test]
fn dpi_serde() {
needs_serde::<LogicalPosition<f64>>();
needs_serde::<PhysicalPosition<i32>>();
needs_serde::<PhysicalPosition<f64>>();
needs_serde::<LogicalSize<f64>>();
needs_serde::<PhysicalSize<u32>>();
}