pub struct StampOptionsBuilder(/* private fields */);Expand description
Builds a StampOptions a setting at a time.
The way to change one field from outside this crate: the type is
#[non_exhaustive], so struct-update syntax is a same-crate spelling.
Every method consumes and returns the builder; build
hands back the options.
use pdfrum::{Color, StampOptions, StampPosition};
let draft = StampOptions::builder()
.position(StampPosition::Center)
.angle(45.0)
.opacity(0.3)
.font_size(96.0)
.color(Color::from_rgb8(200, 0, 0))
.build();
assert_eq!(draft.margin, 36.0);Implementations§
Source§impl StampOptionsBuilder
impl StampOptionsBuilder
Sourcepub fn position(self, position: StampPosition) -> Self
pub fn position(self, position: StampPosition) -> Self
Where the stamp’s box sits — StampOptions::position.
use pdfrum::{StampOptions, StampPosition};
let options = StampOptions::builder().position(StampPosition::TopRight).build();Sourcepub fn margin(self, margin: f64) -> Self
pub fn margin(self, margin: f64) -> Self
Points between a corner-placed stamp and the crop box —
StampOptions::margin.
let options = pdfrum::StampOptions::builder().margin(18.0).build();
assert_eq!(options.margin, 18.0);Sourcepub fn angle(self, angle: f64) -> Self
pub fn angle(self, angle: f64) -> Self
Degrees counter-clockwise — StampOptions::angle.
let options = pdfrum::StampOptions::builder().angle(45.0).build();
assert_eq!(options.angle, 45.0);Sourcepub fn opacity(self, opacity: f32) -> Self
pub fn opacity(self, opacity: f32) -> Self
Constant alpha, 0.0 to 1.0 — StampOptions::opacity.
let options = pdfrum::StampOptions::builder().opacity(0.3).build();
assert_eq!(options.opacity, 0.3);Sourcepub fn font(self, font: StandardFont) -> Self
pub fn font(self, font: StandardFont) -> Self
The face for a text stamp — StampOptions::font.
use pdfrum::{StampOptions, StandardFont};
let options = StampOptions::builder().font(StandardFont::Courier).build();Sourcepub fn font_size(self, size: f32) -> Self
pub fn font_size(self, size: f32) -> Self
The text size in points — StampOptions::font_size.
let options = pdfrum::StampOptions::builder().font_size(96.0).build();
assert_eq!(options.font_size, 96.0);Sourcepub fn color(self, color: Color) -> Self
pub fn color(self, color: Color) -> Self
The text colour — StampOptions::color.
let options = pdfrum::StampOptions::builder()
.color(pdfrum::Color::from_rgb8(200, 0, 0))
.build();Sourcepub fn build(self) -> StampOptions
pub fn build(self) -> StampOptions
The options as built.
let options = pdfrum::StampOptions::builder().build();
assert_eq!(options, pdfrum::StampOptions::default());Trait Implementations§
Source§impl Clone for StampOptionsBuilder
impl Clone for StampOptionsBuilder
Source§fn clone(&self) -> StampOptionsBuilder
fn clone(&self) -> StampOptionsBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StampOptionsBuilder
impl Debug for StampOptionsBuilder
Source§impl Default for StampOptionsBuilder
impl Default for StampOptionsBuilder
Source§fn default() -> StampOptionsBuilder
fn default() -> StampOptionsBuilder
Returns the “default value” for a type. Read more
Source§impl PartialEq for StampOptionsBuilder
impl PartialEq for StampOptionsBuilder
impl StructuralPartialEq for StampOptionsBuilder
Auto Trait Implementations§
impl Freeze for StampOptionsBuilder
impl RefUnwindSafe for StampOptionsBuilder
impl Send for StampOptionsBuilder
impl Sync for StampOptionsBuilder
impl Unpin for StampOptionsBuilder
impl UnsafeUnpin for StampOptionsBuilder
impl UnwindSafe for StampOptionsBuilder
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