use crate::prelude::*; /// Hide content without affecting layout. #[derive(Debug, Hash)] pub struct HideNode(pub Content); #[node(Layout, Inline)] impl HideNode { fn construct(_: &Vm, args: &mut Args) -> SourceResult { Ok(Self(args.expect("body")?).pack()) } } impl Layout for HideNode { fn layout( &self, world: Tracked, styles: StyleChain, regions: &Regions, ) -> SourceResult { let mut fragment = self.0.layout(world, styles, regions)?; for frame in &mut fragment { frame.clear(); } Ok(fragment) } } impl Inline for HideNode {}