Struct rckive_genpdf::elements::UnorderedList
source · pub struct UnorderedList { /* private fields */ }
Expand description
An unordered list of elements with bullet points.
Examples
With setters:
use rckive_genpdf::elements;
let mut list = elements::UnorderedList::new();
list.push(elements::Paragraph::new("first"));
list.push(elements::Paragraph::new("second"));
list.push(elements::Paragraph::new("third"));
With setters and a custom bullet symbol:
use rckive_genpdf::elements;
let mut list = elements::UnorderedList::with_bullet("*");
list.push(elements::Paragraph::new("first"));
list.push(elements::Paragraph::new("second"));
list.push(elements::Paragraph::new("third"));
Chained:
use rckive_genpdf::elements;
let list = elements::UnorderedList::new()
.element(elements::Paragraph::new("first"))
.element(elements::Paragraph::new("second"))
.element(elements::Paragraph::new("third"));
Nested list using a LinearLayout
:
use rckive_genpdf::elements;
let list = elements::UnorderedList::new()
.element(
elements::OrderedList::new()
.element(elements::Paragraph::new("Sublist with bullet point"))
)
.element(
elements::LinearLayout::vertical()
.element(elements::Paragraph::new("Sublist without bullet point:"))
.element(
elements::OrderedList::new()
.element(elements::Paragraph::new("first"))
.element(elements::Paragraph::new("second"))
)
);
Implementations§
source§impl UnorderedList
impl UnorderedList
sourcepub fn new() -> UnorderedList
pub fn new() -> UnorderedList
Creates a new unordered list with the default bullet point symbol.
sourcepub fn with_bullet(bullet: impl Into<String>) -> UnorderedList
pub fn with_bullet(bullet: impl Into<String>) -> UnorderedList
Creates a new unordered list with the given bullet point symbol.
Trait Implementations§
source§impl Default for UnorderedList
impl Default for UnorderedList
source§fn default() -> UnorderedList
fn default() -> UnorderedList
Returns the “default value” for a type. Read more
source§impl Element for UnorderedList
impl Element for UnorderedList
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: Element + 'static> Extend<E> for UnorderedList
impl<E: Element + 'static> Extend<E> for UnorderedList
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
source§impl<E: Element + 'static> FromIterator<E> for UnorderedList
impl<E: Element + 'static> FromIterator<E> for UnorderedList
source§fn from_iter<I: IntoIterator<Item = E>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = E>>(iter: I) -> Self
Creates a value from an iterator. Read more