Skip to main content

AnnotBorder

Struct AnnotBorder 

Source
#[non_exhaustive]
pub struct AnnotBorder { pub width: f32, pub style: AnnotBorderStyle, pub dash: Option<[i64; 3]>, }
Expand description

Width and style for an annotation /BS dictionary.

Defaults match what Square and Ink wrote previously: width 2, solid.

use pdfrum_edit::{AnnotBorder, AnnotBorderStyle};

let border = AnnotBorder::default();
assert_eq!(border.width, 2.0);
assert_eq!(border.style, AnnotBorderStyle::Solid);

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§width: f32

Border width (/W) in points.

§style: AnnotBorderStyle

Border style (/S).

§dash: Option<[i64; 3]>

Dash pattern /D as [on gap phase], for a AnnotBorderStyle::Dash border.

None writes no /D, and a reader then falls back to its own default of [3 0 0] — so a dashed border without this is dashed, just not to a pattern the file states. The key is written only for a dashed style, since it means nothing to the others.

Implementations§

Source§

impl AnnotBorder

Source

pub fn solid(width: f32) -> Self

A solid border of the given width.

use pdfrum_edit::{AnnotBorder, AnnotBorderStyle};

let border = AnnotBorder::solid(1.5);
assert_eq!(border.width, 1.5);
assert_eq!(border.style, AnnotBorderStyle::Solid);
Source

pub fn with_style(self, style: AnnotBorderStyle) -> Self

Sets the style, keeping the current width.

Source

pub fn with_dash(self, dash: [i64; 3]) -> Self

Sets /D, the dash pattern, as [on gap phase].

Only a AnnotBorderStyle::Dash border writes it. The reader takes the three entries as on-length, gap-length and phase, and an absent /D as its own [3 0 0].

use pdfrum_edit::{AnnotBorder, AnnotBorderStyle};

let border = AnnotBorder::solid(1.0)
    .with_style(AnnotBorderStyle::Dash)
    .with_dash([4, 2, 0]);
assert_eq!(border.dash, Some([4, 2, 0]));

Trait Implementations§

Source§

impl Clone for AnnotBorder

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for AnnotBorder

Source§

impl Debug for AnnotBorder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AnnotBorder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for AnnotBorder

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AnnotBorder

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.