Struct rckive_genpdf::elements::LinearLayout
source · pub struct LinearLayout { /* private fields */ }
Expand description
Arranges a list of elements sequentially.
Currently, elements can only be arranged vertically.
Examples
With setters:
use rckive_genpdf::elements;
let mut layout = elements::LinearLayout::vertical();
layout.push(elements::Paragraph::new("Test1"));
layout.push(elements::Paragraph::new("Test2"));
Chained:
use rckive_genpdf::elements;
let layout = elements::LinearLayout::vertical()
.element(elements::Paragraph::new("Test1"))
.element(elements::Paragraph::new("Test2"));
Implementations§
source§impl LinearLayout
impl LinearLayout
sourcepub fn vertical() -> LinearLayout
pub fn vertical() -> LinearLayout
Creates a new linear layout that arranges its elements vertically.
sourcepub fn push<E: IntoBoxedElement>(&mut self, element: E)
pub fn push<E: IntoBoxedElement>(&mut self, element: E)
Adds the given element to this layout.
sourcepub fn element<E: IntoBoxedElement>(self, element: E) -> Self
pub fn element<E: IntoBoxedElement>(self, element: E) -> Self
Adds the given element to this layout and it returns the layout.
Trait Implementations§
source§impl Element for LinearLayout
impl Element for LinearLayout
source§fn render(
&mut self,
context: &Context,
area: Area<'_>,
style: Style
) -> Result<RenderResult, Error>
fn render(
&mut self,
context: &Context,
area: Area<'_>,
style: Style
) -> Result<RenderResult, Error>
Renders this element to the given area using the given style and font cache. Read more
source§fn framed(self, line_style: impl Into<LineStyle>) -> FramedElement<Self>where
Self: Sized,
fn framed(self, line_style: impl Into<LineStyle>) -> FramedElement<Self>where
Self: Sized,
Draws a frame around this element using the given line style.
source§impl<E: IntoBoxedElement> Extend<E> for LinearLayout
impl<E: IntoBoxedElement> Extend<E> for LinearLayout
source§fn extend<I: IntoIterator<Item = E>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = E>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more