pub struct FlowSolver { /* private fields */ }Expand description
A RulesSolver for flows
The flow direction is currently restricted to lines which flow to the right, wrapping down (as in English text).
Margins of the “flow” as a whole are the maximum of all item margins since it is not known in advance which items will be on the first/last line or at the start/end of each line.
Implementations§
Source§impl FlowSolver
impl FlowSolver
Sourcepub fn new(
axis: AxisInfo,
direction: Direction,
secondary_is_reversed: bool,
len: usize,
storage: &mut FlowStorage,
) -> Self
pub fn new( axis: AxisInfo, direction: Direction, secondary_is_reversed: bool, len: usize, storage: &mut FlowStorage, ) -> Self
Construct a solver
Parameters:
axis:AxisInfoinstance passed intosize_rulesdirection: primary direction of flow (lines)secondary_is_reversed: true if the direction in which lines wrap is left or up (this corresponds toDirectional::is_reversed)len: and total number of itemsstorage: reference to persistent storage
Sourcepub fn set_num_columns(&mut self, min: i32, ideal: i32)
pub fn set_num_columns(&mut self, min: i32, ideal: i32)
Set the (minimum, ideal) numbers of columns
This affects the final SizeRules for the horizontal axis.
By default, the values 1, 3 are used.
Sourcepub fn set_column_properties(&mut self, width: i32)
pub fn set_column_properties(&mut self, width: i32)
Set column width
When the primary direction is vertical, the column width cannot be inferred. Set it with this method. (In other cases this does nothing.)
This does not directly affect the returned SizeRules, but it does
affect the width supplied to children when inferring their height
(see AxisInfo::other), which could be useful if e.g. child widgtes
contain text which wraps at this width.
Further note: the result of Self::finish for the horizontal axis
will be just the maximum SizeRules of all children. You may wish to
call SizeRules::multiply_with_margin for the horizontal axis to
reserve enough room for multiple columns.
Trait Implementations§
Source§impl RulesSolver for FlowSolver
impl RulesSolver for FlowSolver
Source§type Storage = FlowStorage
type Storage = FlowStorage
Source§type ChildInfo = usize
type ChildInfo = usize
RulesSolver::for_child (see implementation documentation)Auto Trait Implementations§
impl Freeze for FlowSolver
impl RefUnwindSafe for FlowSolver
impl Send for FlowSolver
impl Sync for FlowSolver
impl Unpin for FlowSolver
impl UnwindSafe for FlowSolver
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
Source§impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
Source§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
Source§fn cast_approx(self) -> T
fn cast_approx(self) -> T
Source§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
Source§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Source§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Source§fn cast_floor(self) -> T
fn cast_floor(self) -> T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.