pub struct Fragment {
pub node: NodeId,
pub position: Point,
pub size: Size,
pub padding: Edges,
pub border: Edges,
pub margin: Edges,
pub children: Vec<Fragment>,
pub kind: FragmentKind,
}Expand description
A fragment produced by layout.
Fields§
§node: NodeIdThe box tree node this fragment corresponds to.
position: PointPosition relative to parent fragment.
size: SizeContent box size.
padding: EdgesResolved padding.
border: EdgesResolved border widths.
margin: EdgesResolved margin.
children: Vec<Fragment>Child fragments.
kind: FragmentKindFragment kind.
Implementations§
Source§impl Fragment
impl Fragment
pub fn new(node: NodeId, kind: FragmentKind) -> Self
Sourcepub fn border_box(&self) -> Rect
pub fn border_box(&self) -> Rect
Border box rect (position + padding + border + content, relative to parent).
Sourcepub fn margin_box(&self) -> Rect
pub fn margin_box(&self) -> Rect
Margin box rect (position + margin + border + padding + content, relative to parent).
Sourcepub fn content_box(&self) -> Rect
pub fn content_box(&self) -> Rect
Content box rect (position offset by border + padding).
Sourcepub fn absolute_position(&self, ancestors: &[&Fragment]) -> Point
pub fn absolute_position(&self, ancestors: &[&Fragment]) -> Point
Compute absolute position by walking up the tree. The position is the top-left of the border box in viewport coordinates.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Fragment
impl RefUnwindSafe for Fragment
impl Send for Fragment
impl Sync for Fragment
impl Unpin for Fragment
impl UnwindSafe for Fragment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more