pub struct PaddedElement<E: Element> {
element: E,
padding: Margins,
}Expand description
Adds a padding to the wrapped element.
§Examples
Direct usage:
use genpdfi_extended::elements;
let p = elements::PaddedElement::new(
elements::Paragraph::new("text"),
genpdfi_extended::Margins::trbl(5, 2, 5, 10),
);Using Element::padded:
use genpdfi_extended::{elements, Element as _};
let p = elements::Paragraph::new("text")
.padded(genpdfi_extended::Margins::trbl(5, 2, 5, 10));Fields§
§element: E§padding: MarginsImplementations§
Source§impl<E: Element> PaddedElement<E>
impl<E: Element> PaddedElement<E>
Sourcepub fn new(element: E, padding: impl Into<Margins>) -> PaddedElement<E>
pub fn new(element: E, padding: impl Into<Margins>) -> PaddedElement<E>
Creates a new padded element that wraps the given element with the given padding.
Trait Implementations§
Source§impl<E: Clone + Element> Clone for PaddedElement<E>
impl<E: Clone + Element> Clone for PaddedElement<E>
Source§fn clone(&self) -> PaddedElement<E>
fn clone(&self) -> PaddedElement<E>
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 moreSource§impl<E: Default + Element> Default for PaddedElement<E>
impl<E: Default + Element> Default for PaddedElement<E>
Source§fn default() -> PaddedElement<E>
fn default() -> PaddedElement<E>
Returns the “default value” for a type. Read more
Source§impl<E: Element> Element for PaddedElement<E>
impl<E: Element> Element for PaddedElement<E>
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.
Auto Trait Implementations§
impl<E> Freeze for PaddedElement<E>where
E: Freeze,
impl<E> RefUnwindSafe for PaddedElement<E>where
E: RefUnwindSafe,
impl<E> Send for PaddedElement<E>where
E: Send,
impl<E> Sync for PaddedElement<E>where
E: Sync,
impl<E> Unpin for PaddedElement<E>where
E: Unpin,
impl<E> UnwindSafe for PaddedElement<E>where
E: UnwindSafe,
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<E> IntoBoxedElement for Ewhere
E: Element + 'static,
impl<E> IntoBoxedElement for Ewhere
E: Element + 'static,
Source§fn into_boxed_element(self) -> Box<dyn Element>
fn into_boxed_element(self) -> Box<dyn Element>
Creates a boxed element from this element.
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.