pub struct Area {
pub area_type: AreaType,
pub geometry: Rect,
pub traits: TraitSet,
pub content: Option<AreaContent>,
pub keep_constraint: Option<KeepConstraint>,
pub break_before: Option<BreakValue>,
pub break_after: Option<BreakValue>,
pub widows: i32,
pub orphans: i32,
}Expand description
An area represents a rectangular region on a page
Fields§
§area_type: AreaTypeArea type
geometry: RectPosition and size
traits: TraitSetRendering traits (color, background, borders, etc.)
content: Option<AreaContent>Content (text or image data)
keep_constraint: Option<KeepConstraint>Keep constraints for page breaking
break_before: Option<BreakValue>Break-before property value
break_after: Option<BreakValue>Break-after property value
widows: i32Widows constraint - minimum lines at top of page after break
orphans: i32Orphans constraint - minimum lines at bottom of page before break
Implementations§
Source§impl Area
impl Area
Sourcepub fn viewport_with_image(geometry: Rect, image_data: Vec<u8>) -> Self
pub fn viewport_with_image(geometry: Rect, image_data: Vec<u8>) -> Self
Create a viewport area for an image
Sourcepub fn with_traits(self, traits: TraitSet) -> Self
pub fn with_traits(self, traits: TraitSet) -> Self
Set the area’s traits
Sourcepub fn with_keep_constraint(self, keep_constraint: KeepConstraint) -> Self
pub fn with_keep_constraint(self, keep_constraint: KeepConstraint) -> Self
Set the area’s keep constraint
Sourcepub fn with_break_before(self, break_before: BreakValue) -> Self
pub fn with_break_before(self, break_before: BreakValue) -> Self
Set the area’s break-before value
Sourcepub fn with_break_after(self, break_after: BreakValue) -> Self
pub fn with_break_after(self, break_after: BreakValue) -> Self
Set the area’s break-after value
Sourcepub fn with_widows(self, widows: i32) -> Self
pub fn with_widows(self, widows: i32) -> Self
Set the area’s widows constraint
Sourcepub fn with_orphans(self, orphans: i32) -> Self
pub fn with_orphans(self, orphans: i32) -> Self
Set the area’s orphans constraint
Sourcepub fn has_image_data(&self) -> bool
pub fn has_image_data(&self) -> bool
Check if this area contains image data
Sourcepub fn text_content(&self) -> Option<&str>
pub fn text_content(&self) -> Option<&str>
Get text content if this is a text area
Sourcepub fn image_data(&self) -> Option<&[u8]>
pub fn image_data(&self) -> Option<&[u8]>
Get image data if this is an image area
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Area
impl RefUnwindSafe for Area
impl Send for Area
impl Sync for Area
impl Unpin for Area
impl UnsafeUnpin for Area
impl UnwindSafe for Area
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