don't do sketchy egui Id stuff
This commit is contained in:
17
src/misc.rs
17
src/misc.rs
@@ -1,4 +1,3 @@
|
||||
use egui::Id;
|
||||
use egui_plot::{Line, PlotPoint, PlotPoints, Points};
|
||||
use emath::Pos2;
|
||||
use getrandom::getrandom;
|
||||
@@ -27,10 +26,14 @@ impl EguiHelper for Vec<PlotPoint> {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn to_line(self) -> Line { Line::new(self.to_values()) }
|
||||
fn to_line(self) -> Line {
|
||||
Line::new(self.to_values())
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn to_points(self) -> Points { Points::new(self.to_values()) }
|
||||
fn to_points(self) -> Points {
|
||||
Points::new(self.to_values())
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn to_tuple(self) -> Vec<(f64, f64)> {
|
||||
@@ -59,10 +62,6 @@ impl const Offset for Pos2 {
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn create_id(x: u64) -> Id { unsafe { std::mem::transmute::<u64, Id>(x) } }
|
||||
|
||||
pub const fn get_u64_id(id: Id) -> u64 { unsafe { std::mem::transmute::<Id, u64>(id) } }
|
||||
|
||||
/*
|
||||
/// Rounds f64 to `n` decimal places
|
||||
pub fn decimal_round(x: f64, n: usize) -> f64 {
|
||||
@@ -198,4 +197,6 @@ pub fn random_u64() -> Result<u64, getrandom::Error> {
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/valid_chars.rs"));
|
||||
|
||||
pub fn is_valid_char(c: char) -> bool { c.is_alphanumeric() | VALID_EXTRA_CHARS.contains(&c) }
|
||||
pub fn is_valid_char(c: char) -> bool {
|
||||
c.is_alphanumeric() | VALID_EXTRA_CHARS.contains(&c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user