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
|
|
@ -269,8 +269,9 @@ impl Theme {
|
|||
#[cold]
|
||||
pub fn apply_vs_code(self) -> Result<(), OutputError> {
|
||||
let vs_theme = VsTheme::from(self);
|
||||
let config_dir = dirs::config_dir().ok_or(OutputError::MissingConfigDir)?;
|
||||
let vs_code_dir = config_dir.join("Code").join("User");
|
||||
let mut config_dir = dirs::config_dir().ok_or(OutputError::MissingConfigDir)?;
|
||||
config_dir.extend(["Code", "User"]);
|
||||
let vs_code_dir = config_dir;
|
||||
if !vs_code_dir.exists() {
|
||||
std::fs::create_dir_all(&vs_code_dir).map_err(OutputError::Io)?;
|
||||
}
|
||||
|
|
@ -292,9 +293,9 @@ impl Theme {
|
|||
|
||||
#[cold]
|
||||
pub fn reset_vs_code() -> Result<(), OutputError> {
|
||||
let config_dir = dirs::config_dir().ok_or(OutputError::MissingConfigDir)?;
|
||||
let vs_code_dir = config_dir.join("Code").join("User");
|
||||
let settings_file = vs_code_dir.join("settings.json");
|
||||
let mut config_dir = dirs::config_dir().ok_or(OutputError::MissingConfigDir)?;
|
||||
config_dir.extend(["Code", "User", "settings.json"]);
|
||||
let settings_file = config_dir;
|
||||
// just remove the json entry for workbench.colorCustomizations
|
||||
let settings = std::fs::read_to_string(&settings_file).unwrap_or_default();
|
||||
let mut settings: serde_json::Value = serde_json::from_str(&settings).unwrap_or_default();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue