pub trait Searching {
// Required methods
fn find(&self, matcher: &dyn Fn(&Frame) -> bool) -> Option<Frame>;
fn find_buildable(&self) -> Option<Frame>;
fn find_top(&self) -> Option<Frame>;
fn find_with_sid(&self, sid: SurfaceId) -> Option<Frame>;
fn find_pointed(&self, point: Position) -> Frame;
fn find_neighbouring(&self, direction: Direction) -> Option<Frame>;
fn find_contiguous(
&self,
direction: Direction,
distance: u32,
) -> Option<Frame>;
fn find_adjacent(
&self,
direction: Direction,
distance: u32,
) -> Option<Frame>;
}Expand description
Extension trait for Frame adding more search functionality.
Required Methods§
Sourcefn find(&self, matcher: &dyn Fn(&Frame) -> bool) -> Option<Frame>
fn find(&self, matcher: &dyn Fn(&Frame) -> bool) -> Option<Frame>
Returns first found frame upon which matcher returned true.
Sourcefn find_buildable(&self) -> Option<Frame>
fn find_buildable(&self) -> Option<Frame>
Finds first frame suitable for building.
Returns self if self has no surface ID set, its parent otherwise.
Sourcefn find_with_sid(&self, sid: SurfaceId) -> Option<Frame>
fn find_with_sid(&self, sid: SurfaceId) -> Option<Frame>
Finds frame with given surface ID.
Sourcefn find_pointed(&self, point: Position) -> Frame
fn find_pointed(&self, point: Position) -> Frame
Finds leaf frame contained in frame self containing point or the closest one if point
lies outside self.
Sourcefn find_neighbouring(&self, direction: Direction) -> Option<Frame>
fn find_neighbouring(&self, direction: Direction) -> Option<Frame>
Returns neighbour in given planar direction. If parent is not aligned in the direction or
neighbour is not found returns None.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".