Skip to main content

laser_pdf/elements/
empty.rs

1use crate::*;
2
3/// An element with a zero size.
4///
5/// Compared to [crate::elements::none::NoneElement] it does not trigger collapse behavior.
6pub struct Empty;
7
8impl Element for Empty {
9    fn first_location_usage(&self, _ctx: FirstLocationUsageCtx) -> FirstLocationUsage {
10        FirstLocationUsage::WillUse
11    }
12
13    fn measure(&self, _ctx: MeasureCtx) -> ElementSize {
14        ElementSize {
15            width: Some(0.),
16            height: Some(0.),
17        }
18    }
19
20    fn draw(&self, _ctx: DrawCtx) -> ElementSize {
21        ElementSize {
22            width: Some(0.),
23            height: Some(0.),
24        }
25    }
26}