pub struct DragTargetView<State, T>where
State: 'static,
T: 'static,{ /* private fields */ }Expand description
A declarative drop target. See the module docs.
Implementations§
Source§impl<State, T> DragTargetView<State, T>where
State: 'static,
T: 'static,
impl<State, T> DragTargetView<State, T>where
State: 'static,
T: 'static,
Sourcepub fn accepts<F>(self, f: F) -> DragTargetView<State, T>
pub fn accepts<F>(self, f: F) -> DragTargetView<State, T>
Only accept a payload f returns true for (default: accept every
T). A payload that fails this shows DragHighlight::Reject and is
never taken — see the module docs.
Sourcepub fn on_enter<F>(self, f: F) -> DragTargetView<State, T>where
F: Fn(&mut State) + 'static,
pub fn on_enter<F>(self, f: F) -> DragTargetView<State, T>where
F: Fn(&mut State) + 'static,
Run f against the app state when a session carrying a T first hovers
this target.
Sourcepub fn on_leave<F>(self, f: F) -> DragTargetView<State, T>where
F: Fn(&mut State) + 'static,
pub fn on_leave<F>(self, f: F) -> DragTargetView<State, T>where
F: Fn(&mut State) + 'static,
Run f against the app state when a hovering T session stops hovering
this target without dropping on it.
Sourcepub fn on_hover<F>(self, f: F) -> DragTargetView<State, T>
pub fn on_hover<F>(self, f: F) -> DragTargetView<State, T>
Run f against the app state, with the pointer converted to this
widget’s local space, on every distinct pointer position seen while a
T session hovers this target.
Sourcepub fn on_drop<F>(self, f: F) -> DragTargetView<State, T>where
F: Fn(&mut State, T) + 'static,
pub fn on_drop<F>(self, f: F) -> DragTargetView<State, T>where
F: Fn(&mut State, T) + 'static,
Run f against the app state with the dropped payload when an accepted
T session is released on this target.
Sourcepub fn highlight<F>(self, f: F) -> DragTargetView<State, T>
pub fn highlight<F>(self, f: F) -> DragTargetView<State, T>
Override the highlight paint seam (default: a 2px rounded inset stroke in the theme’s primary color). See the module docs.
Trait Implementations§
Source§impl<State, T> View<State> for DragTargetView<State, T>where
State: 'static,
T: 'static,
impl<State, T> View<State> for DragTargetView<State, T>where
State: 'static,
T: 'static,
Source§type Element = DragTargetWidget<State, T>
type Element = DragTargetWidget<State, T>
Source§fn build(
&self,
ctx: &mut BuildCtx<'_>,
) -> <DragTargetView<State, T> as View<State>>::Element
fn build( &self, ctx: &mut BuildCtx<'_>, ) -> <DragTargetView<State, T> as View<State>>::Element
Source§fn rebuild(
&self,
prev: &DragTargetView<State, T>,
element: &mut <DragTargetView<State, T> as View<State>>::Element,
ctx: &mut BuildCtx<'_>,
) -> ChangeFlags
fn rebuild( &self, prev: &DragTargetView<State, T>, element: &mut <DragTargetView<State, T> as View<State>>::Element, ctx: &mut BuildCtx<'_>, ) -> ChangeFlags
prev (the previous view of the same type) against the live
element, mutating it in place and reporting what changed.Auto Trait Implementations§
impl<State, T> !RefUnwindSafe for DragTargetView<State, T>
impl<State, T> !Send for DragTargetView<State, T>
impl<State, T> !Sync for DragTargetView<State, T>
impl<State, T> !UnwindSafe for DragTargetView<State, T>
impl<State, T> Freeze for DragTargetView<State, T>
impl<State, T> Unpin for DragTargetView<State, T>
impl<State, T> UnsafeUnpin for DragTargetView<State, T>where
AnyView<State>: UnsafeUnpin,
Rc<dyn Fn(&T) -> bool>: UnsafeUnpin,
Option<Rc<dyn Fn(&mut State)>>: UnsafeUnpin,
Option<Rc<dyn Fn(&mut State, Point)>>: UnsafeUnpin,
Option<Rc<dyn Fn(&mut State, T)>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Source§impl<State, V> ViewSeq<State, One> for Vwhere
State: 'static,
V: View<State>,
impl<State, V> ViewSeq<State, One> for Vwhere
State: 'static,
V: View<State>,
Source§fn extend_views(self, out: &mut Vec<AnyView<State>>)
fn extend_views(self, out: &mut Vec<AnyView<State>>)
out — erasing each
with AnyView::new (a no-op for an element already an AnyView).