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: Self
Sourcepub const fn new(size: i32, inner: (u16, u16), outer: (u16, u16)) -> Self
pub const fn new(size: i32, inner: (u16, u16), outer: (u16, u16)) -> Self
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 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
offsetwithin 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
sizevalue)
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 Freeze for FrameRules
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
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more