Skip to main content

Fragment

Struct Fragment 

Source
pub struct Fragment {
Show 15 fields pub x: f32, pub lead: f32, pub fixed: f32, pub height: f32, pub break_before: BreakPoint, pub piece: Piece, pub marks: Option<Box<Marks>>, pub decorations: Option<Box<Decorations>>, pub markers: Option<Box<Vec<Marker>>>, pub notes: Option<Box<Vec<Arc<Note>>>>, pub reflow: Option<Arc<Reflow>>, pub spanning: bool, pub layer: i32, pub offset: (f32, f32), pub opacity: f32,
}
Expand description

One thing the flow can place: a line, an image, an ornament.

Everything horizontal is settled here — indentation, alignment, the measure a drop cap left — so the flow only stacks.

Fields§

§x: f32

Leading edge, from the content box’s own.

§lead: f32

Space above, from the margins around it. A page that opens on this fragment drops it.

§fixed: f32

Space above that a page break does not drop and no margin collapses through: the borders and padding between this fragment and whatever is above it.

§height: f32

The fragment’s own height.

§break_before: BreakPoint

Whether a page may end above it.

§piece: Piece

What it paints.

§marks: Option<Box<Marks>>

What it tells the page furniture when it lands. Boxed because a book has thousands of fragments and a handful of chapter headings.

§decorations: Option<Box<Decorations>>

The decorated blocks this fragment opens and closes. Boxed for the same reason: most fragments decorate nothing.

§markers: Option<Box<Vec<Marker>>>

The markers of the list items that open on this fragment, outermost first. Boxed, because most fragments open no item.

§notes: Option<Box<Vec<Arc<Note>>>>

The notes whose references were set on this fragment, in the order they were written. They are set at the foot of whichever page the fragment lands on. Boxed: a book has thousands of lines and a handful of notes.

§reflow: Option<Arc<Reflow>>

The paragraph this line came out of, shared by every line of it, and None on everything else. The flow reads it where an image narrows the bands the paragraph is set in. A book that anchors nothing keeps none of this.

§spanning: bool

Whether it came out of a block that spans every column, from column-span: all. Its leading edge and its measure are then the whole content box’s rather than one column’s.

§layer: i32

The layer the fragment’s own items paint in, from the z-index of the block it came out of. A row carries the layers of the table it is part of on its items, so this is not read for one.

§offset: (f32, f32)

How far position: relative moves what the fragment paints, across and down, from the blocks it came out of. Nothing around the fragment moves with it.

§opacity: f32

How much of what the fragment paints shows, from 0 to 1: the opacity of the blocks it came out of, multiplied together.

Trait Implementations§

Source§

impl Clone for Fragment

Source§

fn clone(&self) -> Fragment

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 Debug for Fragment

Source§

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

Formats the value using the given formatter. Read more

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
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Finish for T

§

fn finish(self)

Does nothing but move self, equivalent to drop.
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> 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
§

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

§

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

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

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

§

fn to_owned_table(&self) -> U

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.