Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/path/standard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@ impl<E,S> RefClonable for SimplePath<E,S> where E: Env, S: SubPath<E> + Send+Syn
}
}

unsafe impl<E,S> Statize<E> for SimplePath<E,S> where E: Env, S: SubPath<E> + Send+Sync + 'static {
type Statur = Self;
}

//TODO fix the AsWidget generic impl
/*impl<E,S> AsWidget<'static,E> for SimplePath<E,S> where E: Env {
fn as_ref<'s>(&'s self) -> Resolvable<'s,E> where 'static: 's {
Expand Down
7 changes: 0 additions & 7 deletions src/validation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,4 @@ pub trait ValidationMut<E>: Validation<E> {
fn validate(&mut self) -> Arc<dyn Any>;
}

unsafe impl<E> Statize<E> for dyn Validation<E> where E: 'static {
type Statur = dyn Validation<E>;
}
unsafe impl<E> Statize<E> for dyn ValidationMut<E> where E: 'static {
type Statur = dyn ValidationMut<E>;
}

traitcast_for!(Validation<E>;ValidationMut<E>);
120 changes: 0 additions & 120 deletions src/widget/cast.rs
Original file line number Diff line number Diff line change
@@ -1,120 +0,0 @@
//! functionality for downcast or traitcast widget references
use super::*;

//TODO simplify Statize and downcast impls into AnyLt struct
/// Trait for retrieving the TypeId of a non-'static type by providing the 'static variant of the type
///
/// See [RFC 1849](https://github.com/rust-lang/rust/issues/41875)
#[deprecated]
pub unsafe trait Statize<E> {
/// Must be `Self`, but with all lifetimes 'static
type Statur: ?Sized + 'static;

#[inline(always)]
fn _typeid() -> TypeId {
TypeId::of::<Self::Statur>()
}
}

/// StatizeSized is Statize but with Statur: Sized
///
/// StatizeSized is implemented on all Statize where Statur: Sized
#[deprecated]
pub unsafe trait StatizeSized<E> {
type StaturSized: Sized + 'static; //TODO rename to Statur

#[inline(always)]
fn _typeid() -> TypeId {
TypeId::of::<Self::StaturSized>()
}
}

#[allow(deprecated)]
mod imp {
use super::*;
use std::{borrow::Cow, path::{Path,PathBuf}, sync::Arc, rc::Rc};

unsafe impl<T,E> StatizeSized<E> for T where T: Statize<E>, T::Statur: Sized {
type StaturSized = T::Statur;
}

unsafe impl<E> Statize<E> for dyn Widget<E>+'_ where E: Env {
type Statur = dyn Widget<E>+'static;
}
unsafe impl<'w,E> Statize<E> for dyn WidgetMut<E>+'_ where E: Env {
type Statur = dyn WidgetMut<E>+'static;
}
unsafe impl<E> Statize<E> for dyn Any {
type Statur = dyn Any;
}

unsafe impl<'w,T,E> Statize<E> for Box<T> where T: Statize<E>+?Sized {
type Statur = Box<T::Statur>;
}
unsafe impl<'w,T,E> Statize<E> for Rc<T> where T: Statize<E>+?Sized {
type Statur = Rc<T::Statur>;
}
unsafe impl<'w,T,E> Statize<E> for Arc<T> where T: Statize<E>+?Sized {
type Statur = Arc<T::Statur>;
}
unsafe impl<'w,T,E> Statize<E> for Vec<T> where T: StatizeSized<E> {
type Statur = Vec<T::StaturSized>;
}
unsafe impl<'w,T,E> Statize<E> for Option<T> where T: StatizeSized<E> {
type Statur = Option<T::StaturSized>;
}
unsafe impl<'w,T,U,E> Statize<E> for Result<T,U> where T: StatizeSized<E>, U: StatizeSized<E> {
type Statur = Result<T::StaturSized,U::StaturSized>;
}
unsafe impl<'w,T,E> Statize<E> for Cow<'w,T> where T: Statize<E>+Clone+?Sized, T::Statur: Clone {
type Statur = Cow<'static,T::Statur>;
}
unsafe impl<'w,T,E> Statize<E> for &'w T where T: Statize<E>+?Sized {
type Statur = &'static T::Statur;
}
unsafe impl<'w,T,E> Statize<E> for &'w mut T where T: Statize<E>+?Sized {
type Statur = &'static mut T::Statur;
}
unsafe impl<'w,T,E> Statize<E> for [T] where T: StatizeSized<E> {
type Statur = [T::StaturSized];
}

macro_rules! impl_statize_static {
($t:ty;$($tt:ty);+) => {
impl_statize_static!($t);
impl_statize_static!($($tt);*);
};
($t:ty) => {
unsafe impl<E> Statize<E> for $t {
type Statur = Self;
}
}
}

impl_statize_static!(
bool;char;();
f32;f64;
i8;i16;i32;i64;i128;isize;
u8;u16;u32;u64;u128;usize;
str;String;//&'static str;
Path;PathBuf;
crate::widgets::textbox::state::Cursor;
StdID;
StdGonstraints;StdGonstraintAxis
);

macro_rules! impl_statize_tuple {
($t:ident $($tt:ident)+) => {
impl_statize_tuple!($($tt)+);

unsafe impl<E,$t,$($tt),+> Statize<E> for ($t,$($tt),+) where
$t: StatizeSized<E>,
$($tt: StatizeSized<E>),+ {
type Statur = ($t::StaturSized,$($tt::StaturSized),+);
}
};
($t:ident) => {}
}

impl_statize_tuple!(A B C D F G H I J K L M N O P Q R S T U V W X Y Z AA AB AC AD AE AF AG);
}
4 changes: 0 additions & 4 deletions src/widgets/null/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,3 @@ impl<'w,E> WidgetMut<'w,E> for Null<E> where
Err(())
}
}

unsafe impl<E> Statize<E> for Null<E> where E: Env {
type Statur = Self;
}
7 changes: 0 additions & 7 deletions src/widgets/util/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,4 @@ impl<E,A,F,T> AtomState<E,T> for &AtomStateOnSet<E,A,F,T> where E: Env, A: AtomS
}
}

unsafe impl<T,E> Statize<E> for dyn AtomState<E,T> where T: 'static, E: Env {
type Statur = dyn AtomState<E,T>;
}
unsafe impl<T,E> Statize<E> for dyn AtomStateMut<E,T> where T: 'static, E: Env {
type Statur = dyn AtomStateMut<E,T>;
}

traitcast_for!(<T> AtomState<E,T>;AtomStateMut<E,T> where T: 'static);