pub struct DefaultCost(pub i32, pub i32);Expand description
The default cost type used for documents.
It is composed of two values: the badness and the number of newlines. The badness quantifies how much the layout overflows the desired page width. When this cost is used, the badness will be minimized first, then the number of newlines will be minimized from there.
This cost is generally used with the DefaultCostFactory, but it is valid
to use it with a custom cost factory if it serves your needs.
Tuple Fields§
§0: i32The badness of the layout.
1: i32The number of newlines the layout produced.
Trait Implementations§
Source§impl Add for DefaultCost
impl Add for DefaultCost
Source§impl Clone for DefaultCost
impl Clone for DefaultCost
Source§fn clone(&self) -> DefaultCost
fn clone(&self) -> DefaultCost
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for DefaultCost
impl Cost for DefaultCost
Source§impl Debug for DefaultCost
impl Debug for DefaultCost
impl Eq for DefaultCost
Source§impl Ord for DefaultCost
impl Ord for DefaultCost
Source§fn cmp(&self, other: &DefaultCost) -> Ordering
fn cmp(&self, other: &DefaultCost) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for DefaultCost
impl PartialEq for DefaultCost
Source§fn eq(&self, other: &DefaultCost) -> bool
fn eq(&self, other: &DefaultCost) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for DefaultCost
impl PartialOrd for DefaultCost
impl StructuralPartialEq for DefaultCost
Auto Trait Implementations§
impl Freeze for DefaultCost
impl RefUnwindSafe for DefaultCost
impl Send for DefaultCost
impl Sync for DefaultCost
impl Unpin for DefaultCost
impl UnsafeUnpin for DefaultCost
impl UnwindSafe for DefaultCost
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