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 fn new() -> Self
pub fn new() -> Self
Construct a layout engine.
§Examples
use mos_layout::LayoutEngine;
let engine = LayoutEngine::new();
assert_eq!(format!("{engine:?}"), "LayoutEngine");Sourcepub fn layout(&mut self, document: &Document) -> LayoutResult
pub fn layout(&mut 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 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
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
§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.