Set MSRV to 1.71
This commit is contained in:
parent
213ede371b
commit
1291a48d4d
4 changed files with 45 additions and 40 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
name = "libcosmic"
|
name = "libcosmic"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
rust-version = "1.71"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "cosmic"
|
name = "cosmic"
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,11 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::cast_precision_loss)]
|
#[allow(clippy::cast_precision_loss)]
|
||||||
fn variant_button_bounds(
|
fn variant_button_bounds<'b>(
|
||||||
&self,
|
&'b self,
|
||||||
state: &LocalState,
|
state: &'b LocalState,
|
||||||
mut bounds: Rectangle,
|
mut bounds: Rectangle,
|
||||||
) -> impl Iterator<Item = (Entity, Rectangle)> {
|
) -> Box<dyn Iterator<Item = (Entity, Rectangle)> + 'b> {
|
||||||
let num = state.buttons_visible;
|
let num = state.buttons_visible;
|
||||||
let spacing = f32::from(self.spacing);
|
let spacing = f32::from(self.spacing);
|
||||||
let mut homogenous_width = 0.0;
|
let mut homogenous_width = 0.0;
|
||||||
|
|
@ -66,25 +66,27 @@ where
|
||||||
/ num as f32;
|
/ num as f32;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.model
|
Box::new(
|
||||||
.order
|
self.model
|
||||||
.iter()
|
.order
|
||||||
.copied()
|
.iter()
|
||||||
.enumerate()
|
.copied()
|
||||||
.skip(state.buttons_offset)
|
.enumerate()
|
||||||
.take(state.buttons_visible)
|
.skip(state.buttons_offset)
|
||||||
.map(move |(nth, key)| {
|
.take(state.buttons_visible)
|
||||||
let mut this_bounds = bounds;
|
.map(move |(nth, key)| {
|
||||||
|
let mut this_bounds = bounds;
|
||||||
|
|
||||||
if !state.collapsed && Length::Shrink == self.width {
|
if !state.collapsed && Length::Shrink == self.width {
|
||||||
this_bounds.width = state.internal_layout[nth].width;
|
this_bounds.width = state.internal_layout[nth].width;
|
||||||
} else {
|
} else {
|
||||||
this_bounds.width = homogenous_width;
|
this_bounds.width = homogenous_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
bounds.x += this_bounds.width + spacing;
|
bounds.x += this_bounds.width + spacing;
|
||||||
(key, this_bounds)
|
(key, this_bounds)
|
||||||
})
|
}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::cast_precision_loss)]
|
#[allow(clippy::cast_precision_loss)]
|
||||||
|
|
|
||||||
|
|
@ -45,24 +45,26 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::cast_precision_loss)]
|
#[allow(clippy::cast_precision_loss)]
|
||||||
fn variant_button_bounds(
|
fn variant_button_bounds<'b>(
|
||||||
&self,
|
&'b self,
|
||||||
state: &LocalState,
|
state: &'b LocalState,
|
||||||
mut bounds: Rectangle,
|
mut bounds: Rectangle,
|
||||||
) -> impl Iterator<Item = (Entity, Rectangle)> {
|
) -> Box<dyn Iterator<Item = (Entity, Rectangle)> + 'b> {
|
||||||
let spacing = f32::from(self.spacing);
|
let spacing = f32::from(self.spacing);
|
||||||
|
|
||||||
self.model
|
Box::new(
|
||||||
.order
|
self.model
|
||||||
.iter()
|
.order
|
||||||
.copied()
|
.iter()
|
||||||
.enumerate()
|
.copied()
|
||||||
.map(move |(_nth, key)| {
|
.enumerate()
|
||||||
let mut this_bounds = bounds;
|
.map(move |(_nth, key)| {
|
||||||
this_bounds.height = state.internal_layout[0].height;
|
let mut this_bounds = bounds;
|
||||||
bounds.y += this_bounds.height + spacing;
|
this_bounds.height = state.internal_layout[0].height;
|
||||||
(key, this_bounds)
|
bounds.y += this_bounds.height + spacing;
|
||||||
})
|
(key, this_bounds)
|
||||||
|
}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::cast_precision_loss)]
|
#[allow(clippy::cast_precision_loss)]
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,11 @@ pub trait SegmentedVariant {
|
||||||
) -> super::Appearance;
|
) -> super::Appearance;
|
||||||
|
|
||||||
/// Calculates the bounds for visible buttons.
|
/// Calculates the bounds for visible buttons.
|
||||||
fn variant_button_bounds(
|
fn variant_button_bounds<'b>(
|
||||||
&self,
|
&'b self,
|
||||||
state: &LocalState,
|
state: &'b LocalState,
|
||||||
bounds: Rectangle,
|
bounds: Rectangle,
|
||||||
) -> impl Iterator<Item = (Entity, Rectangle)>;
|
) -> Box<dyn Iterator<Item = (Entity, Rectangle)> + 'b>;
|
||||||
|
|
||||||
/// Calculates the layout of this variant.
|
/// Calculates the layout of this variant.
|
||||||
fn variant_layout(
|
fn variant_layout(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue