PrintResult

Struct PrintResult 

Source
pub struct PrintResult<C: Cost> { /* private fields */ }
Expand description

The resolved optimal layout for a successful print attempt.

A PrintResult is returned from Doc::validate and Doc::validate_with_cost when the printer is able to successfully produce a layout for a document.

PrintResult implements Display, so the chosen layout can be rendered through any means that allows.

Implementations§

Source§

impl<C: Cost> PrintResult<C>

Source

pub fn is_tainted(&self) -> bool

Indicates if the layout chosen was tainted.

A tainted layout is one that exceeds the computation width limit imposed by the cost factory. Such a layout won’t be chosen unless there are no valid untainted layouts available. If a tainted layout is chosen, it is not guaranteed to be optimal according to the cost factory.

Source

pub fn cost(&self) -> C

The cost of the chosen layout.

Trait Implementations§

Source§

impl<C: Debug + Cost> Debug for PrintResult<C>

Source§

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

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

impl<C: Cost> Display for PrintResult<C>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<C> Freeze for PrintResult<C>
where C: Freeze,

§

impl<C> !RefUnwindSafe for PrintResult<C>

§

impl<C> !Send for PrintResult<C>

§

impl<C> !Sync for PrintResult<C>

§

impl<C> Unpin for PrintResult<C>
where C: Unpin,

§

impl<C> !UnwindSafe for PrintResult<C>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> ToString for T
where T: Display + ?Sized,

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.