TileExt

Trait TileExt 

Source
pub trait TileExt: Tile {
    // Provided methods
    fn eq_id<T>(&self, rhs: T) -> bool
       where Id: PartialEq<T> { ... }
    fn is_ancestor_of(&self, id: &Id) -> bool { ... }
    fn is_strict_ancestor_of(&self, id: &Id) -> bool { ... }
    fn children(&self) -> impl Iterator<Item = &dyn Tile> { ... }
    fn find_tile(&self, id: &Id) -> Option<&dyn Tile> { ... }
    fn find_tile_rect(&self, id: &Id) -> Option<(Rect, Offset)> { ... }
}
Expand description

Extension trait over widgets

Provided Methods§

Source

fn eq_id<T>(&self, rhs: T) -> bool
where Id: PartialEq<T>,

Test widget identifier for equality

This method may be used to test against Id, Option<Id> and Option<&Id>.

Source

fn is_ancestor_of(&self, id: &Id) -> bool

Check whether id is self or a descendant

This function assumes that id is a valid widget.

Source

fn is_strict_ancestor_of(&self, id: &Id) -> bool

Check whether id is not self and is a descendant

This function assumes that id is a valid widget.

Source

fn children(&self) -> impl Iterator<Item = &dyn Tile>

Return an iterator over visible children

This method may exclude hidden children: see Tile::child_indices.

Source

fn find_tile(&self, id: &Id) -> Option<&dyn Tile>

Find the descendant with this id, if any

Since id represents a path, this operation is normally O(d) where d is the depth of the path (depending on widget implementations).

Source

fn find_tile_rect(&self, id: &Id) -> Option<(Rect, Offset)>

Find the Rect of the descendant with this id, if any

The Rect is returned in the widgets own coordinate space where this space is translated by the Offset returned. The result is thus rect + translation in the caller’s coordinate space.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<W: Tile + ?Sized> TileExt for W