pub struct LayoutEngine;Expand description
The driver for MVP 0 layout.
§Examples
use mos_layout::LayoutEngine;
let engine = LayoutEngine::new();
assert_eq!(format!("{engine:?}"), "LayoutEngine");Implementations§
Source§impl LayoutEngine
impl LayoutEngine
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Construct a layout engine.
§Examples
use mos_layout::LayoutEngine;
let engine = LayoutEngine::new();
assert_eq!(format!("{engine:?}"), "LayoutEngine");Sourcepub fn layout(self, document: &Document) -> LayoutResult
pub fn layout(self, document: &Document) -> LayoutResult
Lay out document into a PageGraph. Never returns an
error in MVP 0: invalid blocks are skipped and surfaced as
diagnostics on LayoutResult instead.
§Examples
use std::path::PathBuf;
use mos_core::Document;
use mos_layout::LayoutEngine;
let doc = Document::new(PathBuf::from("main.mos"));
let result = LayoutEngine::new().layout(&doc);
assert_eq!(result.graph.pages.len(), 1);Trait Implementations§
Source§impl Clone for LayoutEngine
impl Clone for LayoutEngine
Source§fn clone(&self) -> LayoutEngine
fn clone(&self) -> LayoutEngine
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 Debug for LayoutEngine
impl Debug for LayoutEngine
Source§impl Default for LayoutEngine
impl Default for LayoutEngine
Source§fn default() -> LayoutEngine
fn default() -> LayoutEngine
Returns the “default value” for a type. Read more
impl Copy for LayoutEngine
Auto Trait Implementations§
impl Freeze for LayoutEngine
impl RefUnwindSafe for LayoutEngine
impl Send for LayoutEngine
impl Sync for LayoutEngine
impl Unpin for LayoutEngine
impl UnsafeUnpin for LayoutEngine
impl UnwindSafe for LayoutEngine
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,
§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.