Struct kas::layout::FrameRules
source · pub struct FrameRules { /* private fields */ }
Expand description
Frame size rules
This is a special variant of SizeRules
for frames. It is assumed that
frames are not stretchy (i.e. that min-size equals ideal-size); additionally
frame rules have a content offset and a minimum internal margin size.
Implementations§
source§impl FrameRules
impl FrameRules
pub const ZERO: FrameRules = _
sourcepub const fn new(size: i32, inner: (u16, u16), outer: (u16, u16)) -> FrameRules
pub const fn new(size: i32, inner: (u16, u16), outer: (u16, u16)) -> FrameRules
Construct new FrameRules
All parameters use pairs (first, second)
where first
is the top/left
component. Parameters inner
and outer
are inner and outer margin
sizes respectively while size
is the frame size.
If size > 0
then internal margins are the maximum of inner
and
content margin; generated rules have size
content_size + size + inner_margin
and outer margin outer
.
If size ≤ 0
then the generated rules are simply content rules but
with margins the maximum of inner
and content margins; outer
and
size
are ignored (other than to enable this mode).
sourcepub const fn new_sym(size: i32, inner: u16, outer: u16) -> FrameRules
pub const fn new_sym(size: i32, inner: u16, outer: u16) -> FrameRules
Construct (symmetric on axis)
sourcepub fn surround(self, content: SizeRules) -> (SizeRules, i32, i32)
pub fn surround(self, content: SizeRules) -> (SizeRules, i32, i32)
Generate rules for content surrounded by this frame
Returns the tuple (rules, offset, size)
:
- the generated
rules
- the content
offset
within the allocated rect - the size consumed by the frame and inner margins (thus the content’s
size will be that allocated for this object minus this
size
value)
Trait Implementations§
source§impl Clone for FrameRules
impl Clone for FrameRules
source§fn clone(&self) -> FrameRules
fn clone(&self) -> FrameRules
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FrameRules
impl Debug for FrameRules
impl Copy for FrameRules
Auto Trait Implementations§
impl RefUnwindSafe for FrameRules
impl Send for FrameRules
impl Sync for FrameRules
impl Unpin for FrameRules
impl UnwindSafe for FrameRules
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
§impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
§fn cast_approx(self) -> T
fn cast_approx(self) -> T
§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
§fn cast_floor(self) -> T
fn cast_floor(self) -> T
§fn try_cast_trunc(self) -> Result<T, Error>
fn try_cast_trunc(self) -> Result<T, Error>
§fn try_cast_nearest(self) -> Result<T, Error>
fn try_cast_nearest(self) -> Result<T, Error>
§fn try_cast_floor(self) -> Result<T, Error>
fn try_cast_floor(self) -> Result<T, Error>
§fn try_cast_ceil(self) -> Result<T, Error>
fn try_cast_ceil(self) -> Result<T, Error>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.