Merge branch 'master' into sentinel
This commit is contained in:
commit
caecbf20ef
12 changed files with 257 additions and 249 deletions
|
|
@ -48,12 +48,21 @@ impl Length {
|
|||
/// Specifically:
|
||||
/// - [`Length::Shrink`] if [`Length::Shrink`] or [`Length::Fixed`].
|
||||
/// - [`Length::Fill`] otherwise.
|
||||
pub fn fluid(&self) -> Length {
|
||||
pub fn fluid(&self) -> Self {
|
||||
match self {
|
||||
Length::Fill | Length::FillPortion(_) => Length::Fill,
|
||||
Length::Shrink | Length::Fixed(_) => Length::Shrink,
|
||||
}
|
||||
}
|
||||
|
||||
/// Adapts the [`Length`] so it can contain the other [`Length`] and
|
||||
/// match its fluidity.
|
||||
pub fn enclose(self, other: Length) -> Self {
|
||||
match (self, other) {
|
||||
(Length::Shrink, Length::Fill | Length::FillPortion(_)) => other,
|
||||
_ => self,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Pixels> for Length {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue