Trait Searching

Source
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§

Source

fn find(&self, matcher: &dyn Fn(&Frame) -> bool) -> Option<Frame>

Returns first found frame upon which matcher returned true.

Source

fn find_buildable(&self) -> Option<Frame>

Finds first frame suitable for building. Returns self if self has no surface ID set, its parent otherwise.

Source

fn find_top(&self) -> Option<Frame>

Finds first trunk which is Workspace.

Source

fn find_with_sid(&self, sid: SurfaceId) -> Option<Frame>

Finds frame with given surface ID.

Source

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.

Source

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.

Source

fn find_contiguous(&self, direction: Direction, distance: u32) -> Option<Frame>

Finds top-most frame bordering with frame self in given direction.

Source

fn find_adjacent(&self, direction: Direction, distance: u32) -> Option<Frame>

Find find bottom-most frame bordering with frame self in given direction.

Implementors§