pub struct Fragmentainer {
pub size: LogicalSize,
pub used_block_size: f32,
pub is_fixed_size: bool,
pub content: Vec<LayoutBox>,
}Expand description
A single container (fragmentainer) in a fragmentation context.
Each fragmentainer has a logical size and tracks how much of that space has been used. For continuous media, the fragmentainer can grow infinitely. For paged media, fragmentainers have fixed sizes.
Fields§
§size: LogicalSizeLogical size of this container (width and height)
used_block_size: f32How much block-axis space has been used (typically vertical space)
is_fixed_size: boolWhether this container has a fixed size (true for pages) or can grow (false for continuous)
content: Vec<LayoutBox>Content that has been placed in this fragmentainer.
For Phase 1, this is unused. In later phases, we’ll store layout boxes here.
Implementations§
Source§impl Fragmentainer
impl Fragmentainer
Sourcepub fn new(size: LogicalSize, is_fixed_size: bool) -> Self
pub fn new(size: LogicalSize, is_fixed_size: bool) -> Self
Create a new fragmentainer with the given size.
§Arguments
size- The logical size (width and height) of this fragmentaineris_fixed_size- Whether this fragmentainer has a fixed size (true for pages, false for continuous)
Sourcepub fn remaining_space(&self) -> f32
pub fn remaining_space(&self) -> f32
Get the remaining space in this fragmentainer.
- For continuous media, this returns infinity (f32::MAX).
- For paged media, this returns the unused space.
Sourcepub fn is_full(&self) -> bool
pub fn is_full(&self) -> bool
Check if this fragmentainer is full.
- A fragmentainer is considered full if it has less than 1px of remaining space.
- Continuous fragmentainers are never full.
Trait Implementations§
Source§impl Clone for Fragmentainer
impl Clone for Fragmentainer
Source§fn clone(&self) -> Fragmentainer
fn clone(&self) -> Fragmentainer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Fragmentainer
impl RefUnwindSafe for Fragmentainer
impl Send for Fragmentainer
impl Sync for Fragmentainer
impl Unpin for Fragmentainer
impl UnwindSafe for Fragmentainer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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