pub struct TabBarDragData<T: 'static> {
pub source_index: usize,
pub source_bar_id: WidgetId,
pub source_id: TabId,
pub item: Option<T>,
}Expand description
Drag payload published by a tab header when the user starts dragging it.
Generic over the bar’s item type T so a TabBar<T> only ever
downcasts (get_typed::<TabBarDragData<T>>()) a drag started by
another TabBar<T> — a drag from a TabBar<OtherT> simply never
matches, giving cross-bar transfer type-safety for free.
Two consumers:
- Intra-bar reorder: the bar’s own
on_dropmatchessource_bar_id == self_idand usessource_indexto drivemove_item.itemis unused on this path (and may beNone). - Cross-bar transfer: a different bar that opted in via
accept_external_tabstakesitemby value and hands it to itson_tab_receivedcallback.itemisSomeonly when the source bar opted in and the per-tab transferable predicate allows it (static tabs are excluded).
Fields§
§source_index: usizeModel index of the dragged tab in the source bar.
source_bar_id: WidgetIdWidget id of the source TabBar. The receiving bar compares
it to its own id to tell an intra-bar reorder from a
cross-bar transfer.
source_id: TabIdStable id of the dragged tab — handed to the source bar’s
on_transfer_out so the app can remove it by id.
item: Option<T>A clone of the dragged item, carried for cross-bar transfer.
None when the source bar didn’t opt into transfer or the tab
is non-transferable (e.g. a static tab).
Auto Trait Implementations§
impl<T> Freeze for TabBarDragData<T>where
T: Freeze,
impl<T> RefUnwindSafe for TabBarDragData<T>where
T: RefUnwindSafe,
impl<T> Send for TabBarDragData<T>where
T: Send,
impl<T> Sync for TabBarDragData<T>where
T: Sync,
impl<T> Unpin for TabBarDragData<T>where
T: Unpin,
impl<T> UnsafeUnpin for TabBarDragData<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for TabBarDragData<T>where
T: UnwindSafe,
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more