pub struct LayoutManager {
pub coordinate_system: CoordinateSystem,
pub current_y: f64,
pub page_width: f64,
pub page_height: f64,
pub margins: Margins,
pub element_spacing: f64,
}Expand description
Layout manager for intelligent positioning of elements on a page
This manager handles automatic positioning of tables, images, and other elements using different coordinate systems while preventing overlaps and managing page flow.
Fields§
§coordinate_system: CoordinateSystemCoordinate system being used
current_y: f64Current Y position for next element
page_width: f64Page dimensions
page_height: f64§margins: MarginsPage margins
element_spacing: f64Spacing between elements
Implementations§
Source§impl LayoutManager
impl LayoutManager
Sourcepub fn new(page: &Page, coordinate_system: CoordinateSystem) -> Self
pub fn new(page: &Page, coordinate_system: CoordinateSystem) -> Self
Create a new layout manager for the given page
Sourcepub fn with_element_spacing(self, spacing: f64) -> Self
pub fn with_element_spacing(self, spacing: f64) -> Self
Set custom spacing between elements
Sourcepub fn will_fit(&self, element_height: f64) -> bool
pub fn will_fit(&self, element_height: f64) -> bool
Check if an element of given height will fit on the current page
Sourcepub fn remaining_space(&self) -> f64
pub fn remaining_space(&self) -> f64
Get the current available space remaining on the page
Sourcepub fn add_element(&mut self, element_height: f64) -> Option<f64>
pub fn add_element(&mut self, element_height: f64) -> Option<f64>
Reserve space for an element and return its Y position
Returns None if the element doesn’t fit on the current page.
If it fits, returns the Y coordinate where the element should be placed
and updates the internal current_y for the next element.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LayoutManager
impl RefUnwindSafe for LayoutManager
impl Send for LayoutManager
impl Sync for LayoutManager
impl Unpin for LayoutManager
impl UnwindSafe for LayoutManager
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more