Fix different kinds values used for worktree_id
(#17523)
This commit is contained in:
parent
47aec5e64d
commit
8985fd87c2
18 changed files with 136 additions and 127 deletions
|
@ -6,7 +6,7 @@ mod settings_store;
|
|||
|
||||
use gpui::AppContext;
|
||||
use rust_embed::RustEmbed;
|
||||
use std::{borrow::Cow, str};
|
||||
use std::{borrow::Cow, fmt, str};
|
||||
use util::asset_str;
|
||||
|
||||
pub use editable_setting_control::*;
|
||||
|
@ -15,6 +15,39 @@ pub use keymap_file::KeymapFile;
|
|||
pub use settings_file::*;
|
||||
pub use settings_store::{Settings, SettingsLocation, SettingsSources, SettingsStore};
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, PartialOrd, Ord)]
|
||||
pub struct WorktreeId(usize);
|
||||
|
||||
impl From<WorktreeId> for usize {
|
||||
fn from(value: WorktreeId) -> Self {
|
||||
value.0
|
||||
}
|
||||
}
|
||||
|
||||
impl WorktreeId {
|
||||
pub fn from_usize(handle_id: usize) -> Self {
|
||||
Self(handle_id)
|
||||
}
|
||||
|
||||
pub fn from_proto(id: u64) -> Self {
|
||||
Self(id as usize)
|
||||
}
|
||||
|
||||
pub fn to_proto(&self) -> u64 {
|
||||
self.0 as u64
|
||||
}
|
||||
|
||||
pub fn to_usize(&self) -> usize {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for WorktreeId {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
std::fmt::Display::fmt(&self.0, f)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(RustEmbed)]
|
||||
#[folder = "../../assets"]
|
||||
#[include = "settings/*"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue