use crate::{impl_query_self_only, prelude::*};
#[derive(Declare)]
pub struct Void;
impl Render for Void {
fn perform_layout(&self, clamp: BoxClamp, ctx: &mut LayoutCtx) -> Size {
ctx
.single_child_layouter()
.map_or_else(Size::zero, |mut l| l.perform_widget_layout(clamp))
}
fn paint(&self, _: &mut PaintingCtx) {}
fn hit_test(&self, _: &HitTestCtx, _: Point) -> HitTest {
HitTest { hit: false, can_hit_child: true }
}
}
impl Query for Void {
impl_query_self_only!();
}
#[cfg(test)]
mod tests {
use super::*;
use crate::test_helper::*;
use ribir_dev_helper::*;
extern crate test;
use test::Bencher;
fn base() -> Void { Void {} }
widget_bench!(base);
}