pub struct PopupOwner { /* private fields */ }Expand description
Complete identity of the element that owns a popup.
Logical window, native presentation generation, retained-tree namespace, and tree-local element ID are all required to avoid stale/cross-window aliasing. Values are stored without liveness validation.
§Examples
use ailloli_ui_core::ElementId; use ailloli_ui_runtime::{app::PresentationGeneration, popup::{ElementTreeId, PopupOwner}};
let owner = PopupOwner::new("main", PresentationGeneration::new(2), ElementTreeId::new(3), ElementId(4));
assert_eq!(owner.logical_window_id().as_str(), "main");Implementations§
Source§impl PopupOwner
Construction, field access, and exact presentation matching for owners.
impl PopupOwner
Construction, field access, and exact presentation matching for owners.
Sourcepub fn new(
logical_window_id: impl Into<LogicalWindowId>,
presentation_generation: PresentationGeneration,
element_tree_id: ElementTreeId,
element_id: ElementId,
) -> Self
pub fn new( logical_window_id: impl Into<LogicalWindowId>, presentation_generation: PresentationGeneration, element_tree_id: ElementTreeId, element_id: ElementId, ) -> Self
Creates a complete owner identity without checking current liveness.
Empty logical-window IDs and zero numeric IDs are stored verbatim.
§Examples
use ailloli_ui_core::ElementId; use ailloli_ui_runtime::{app::PresentationGeneration, popup::{ElementTreeId, PopupOwner}};
let owner = PopupOwner::new("editor", PresentationGeneration::INITIAL, ElementTreeId::new(0), ElementId(1));
assert_eq!(owner.element_id(), ElementId(1));Sourcepub fn logical_window_id(&self) -> &LogicalWindowId
pub fn logical_window_id(&self) -> &LogicalWindowId
Borrows the stable logical-window ID.
§Examples
use ailloli_ui_core::ElementId; use ailloli_ui_runtime::{app::PresentationGeneration, popup::{ElementTreeId, PopupOwner}};
let owner = PopupOwner::new("main", PresentationGeneration::INITIAL, ElementTreeId::new(0), ElementId(1));
assert_eq!(owner.logical_window_id().as_str(), "main");Sourcepub const fn presentation_generation(&self) -> PresentationGeneration
pub const fn presentation_generation(&self) -> PresentationGeneration
Returns the exact native presentation generation.
§Examples
use ailloli_ui_core::ElementId; use ailloli_ui_runtime::{app::PresentationGeneration, popup::{ElementTreeId, PopupOwner}};
let owner = PopupOwner::new("main", PresentationGeneration::new(9), ElementTreeId::new(0), ElementId(1));
assert_eq!(owner.presentation_generation(), PresentationGeneration::new(9));Sourcepub const fn element_tree_id(&self) -> ElementTreeId
pub const fn element_tree_id(&self) -> ElementTreeId
Returns the retained-tree namespace.
§Examples
use ailloli_ui_core::ElementId; use ailloli_ui_runtime::{app::PresentationGeneration, popup::{ElementTreeId, PopupOwner}};
let owner = PopupOwner::new("main", PresentationGeneration::INITIAL, ElementTreeId::new(4), ElementId(1));
assert_eq!(owner.element_tree_id(), ElementTreeId::new(4));Sourcepub const fn element_id(&self) -> ElementId
pub const fn element_id(&self) -> ElementId
Returns the tree-local owner element ID.
§Examples
use ailloli_ui_core::ElementId; use ailloli_ui_runtime::{app::PresentationGeneration, popup::{ElementTreeId, PopupOwner}};
let owner = PopupOwner::new("main", PresentationGeneration::INITIAL, ElementTreeId::new(0), ElementId(6));
assert_eq!(owner.element_id(), ElementId(6));Sourcepub fn belongs_to(
&self,
logical_window_id: &LogicalWindowId,
presentation_generation: PresentationGeneration,
) -> bool
pub fn belongs_to( &self, logical_window_id: &LogicalWindowId, presentation_generation: PresentationGeneration, ) -> bool
Returns whether this owner belongs to the active presentation of a logical window. Tree and element IDs are deliberately irrelevant to this comparison.
§Examples
use ailloli_ui_core::{ElementId, LogicalWindowId}; use ailloli_ui_runtime::{app::PresentationGeneration, popup::{ElementTreeId, PopupOwner}};
let owner = PopupOwner::new("main", PresentationGeneration::new(2), ElementTreeId::new(3), ElementId(4));
assert!(owner.belongs_to(&LogicalWindowId::new("main"), PresentationGeneration::new(2)));
assert!(!owner.belongs_to(&LogicalWindowId::new("main"), PresentationGeneration::new(3)));Trait Implementations§
Source§impl Clone for PopupOwner
impl Clone for PopupOwner
Source§fn clone(&self) -> PopupOwner
fn clone(&self) -> PopupOwner
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PopupOwner
impl Debug for PopupOwner
Source§impl Hash for PopupOwner
impl Hash for PopupOwner
Source§impl PartialEq for PopupOwner
impl PartialEq for PopupOwner
impl Eq for PopupOwner
impl StructuralPartialEq for PopupOwner
Auto Trait Implementations§
impl Freeze for PopupOwner
impl RefUnwindSafe for PopupOwner
impl Send for PopupOwner
impl Sync for PopupOwner
impl Unpin for PopupOwner
impl UnwindSafe for PopupOwner
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
Source§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.