perf: reduce memory allocations
This also changes `widget::column::with_children` and `widget::row::with_children` to take an `impl IntoIterator` instead of a `Vec`, like the `iced` variants of these functions do. This shouldn't be a breaking change since passing in a `Vec` will still compile and function exactly as before. (Using `iced::widget::Column::from_vec` or `iced::widget::Row::from_vec` isn't possible, since the elements of the `Vec` aren't checked, so the size of the resulting `Column` or `Row` won't adapt to the size of its children. Perhaps a new function could be added to mirror `iced`'s?)
This commit is contained in:
parent
840ef21e4d
commit
bd438a8581
20 changed files with 83 additions and 88 deletions
16
src/core.rs
16
src/core.rs
|
|
@ -361,8 +361,12 @@ impl Core {
|
|||
config_id: &'static str,
|
||||
) -> iced::Subscription<cosmic_config::Update<T>> {
|
||||
#[cfg(all(feature = "dbus-config", target_os = "linux"))]
|
||||
if let Some(settings_daemon) = self.settings_daemon.clone() {
|
||||
return cosmic_config::dbus::watcher_subscription(settings_daemon, config_id, false);
|
||||
if let Some(settings_daemon) = self.settings_daemon.as_ref() {
|
||||
return cosmic_config::dbus::watcher_subscription(
|
||||
settings_daemon.clone(),
|
||||
config_id,
|
||||
false,
|
||||
);
|
||||
}
|
||||
cosmic_config::config_subscription(
|
||||
std::any::TypeId::of::<T>(),
|
||||
|
|
@ -378,8 +382,12 @@ impl Core {
|
|||
state_id: &'static str,
|
||||
) -> iced::Subscription<cosmic_config::Update<T>> {
|
||||
#[cfg(all(feature = "dbus-config", target_os = "linux"))]
|
||||
if let Some(settings_daemon) = self.settings_daemon.clone() {
|
||||
return cosmic_config::dbus::watcher_subscription(settings_daemon, state_id, true);
|
||||
if let Some(settings_daemon) = self.settings_daemon.as_ref() {
|
||||
return cosmic_config::dbus::watcher_subscription(
|
||||
settings_daemon.clone(),
|
||||
state_id,
|
||||
true,
|
||||
);
|
||||
}
|
||||
cosmic_config::config_subscription(
|
||||
std::any::TypeId::of::<T>(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue