From 2c5317556635f9d16a80ff1829f0c51c52a1c6f7 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 18 Mar 2022 10:12:02 -0700 Subject: [PATCH] Rename FollowedItem -> FollowableItem Co-Authored-By: Antonio Scandurra --- crates/workspace/src/workspace.rs | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index b011566c0f..ca1e733fe3 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -50,17 +50,17 @@ type ProjectItemBuilders = HashMap< fn(usize, ModelHandle, AnyModelHandle, &mut MutableAppContext) -> Box, >; -type FollowedItemBuilder = fn( +type FollowableItemBuilder = fn( ViewHandle, ModelHandle, &mut Option, &mut MutableAppContext, ) -> Option>>>; -type FollowedItemBuilders = HashMap< +type FollowableItemBuilders = HashMap< TypeId, ( - FollowedItemBuilder, - fn(AnyViewHandle) -> Box, + FollowableItemBuilder, + fn(AnyViewHandle) -> Box, ), >; @@ -132,7 +132,7 @@ pub fn register_project_item(cx: &mut MutableAppContext) { } pub fn register_followable_item(cx: &mut MutableAppContext) { - cx.update_default_global(|builders: &mut FollowedItemBuilders, _| { + cx.update_default_global(|builders: &mut FollowableItemBuilders, _| { builders.insert( TypeId::of::(), (I::for_state_message, |this| { @@ -251,7 +251,7 @@ pub trait FollowableItem: Item { ) -> Option; } -pub trait FollowedItemHandle { +pub trait FollowableItemHandle { fn id(&self) -> usize; fn to_state_message(&self, cx: &AppContext) -> proto::view::Variant; fn to_update_message( @@ -261,7 +261,7 @@ pub trait FollowedItemHandle { ) -> Option; } -impl FollowedItemHandle for ViewHandle { +impl FollowableItemHandle for ViewHandle { fn id(&self) -> usize { self.id() } @@ -308,7 +308,7 @@ pub trait ItemHandle: 'static { cx: &mut MutableAppContext, ) -> Task>; fn act_as_type(&self, type_id: TypeId, cx: &AppContext) -> Option; - fn to_followed_item_handle(&self, cx: &AppContext) -> Option>; + fn to_followable_item_handle(&self, cx: &AppContext) -> Option>; } pub trait WeakItemHandle { @@ -363,7 +363,7 @@ impl ItemHandle for ViewHandle { pane: ViewHandle, cx: &mut ViewContext, ) { - if let Some(followed_item) = self.to_followed_item_handle(cx) { + if let Some(followed_item) = self.to_followable_item_handle(cx) { workspace.update_followers( proto::update_followers::Variant::CreateView(proto::View { id: followed_item.id() as u64, @@ -401,7 +401,7 @@ impl ItemHandle for ViewHandle { } if let Some(message) = item - .to_followed_item_handle(cx) + .to_followable_item_handle(cx) .and_then(|i| i.to_update_message(event, cx)) { workspace.update_followers( @@ -467,9 +467,9 @@ impl ItemHandle for ViewHandle { self.read(cx).act_as_type(type_id, self, cx) } - fn to_followed_item_handle(&self, cx: &AppContext) -> Option> { - if cx.has_global::() { - let builders = cx.global::(); + fn to_followable_item_handle(&self, cx: &AppContext) -> Option> { + if cx.has_global::() { + let builders = cx.global::(); let item = self.to_any(); Some(builders.get(&item.view_type())?.1(item)) } else { @@ -1186,7 +1186,7 @@ impl Workspace { (this.project.clone(), this.active_pane().clone()) }); let item_builders = cx.update(|cx| { - cx.default_global::() + cx.default_global::() .values() .map(|b| b.0) .collect::>() @@ -1477,7 +1477,7 @@ impl Workspace { let active_view_id = this .active_item(cx) - .and_then(|i| i.to_followed_item_handle(cx)) + .and_then(|i| i.to_followable_item_handle(cx)) .map(|i| i.id() as u64); Ok(proto::FollowResponse { active_view_id, @@ -1485,7 +1485,7 @@ impl Workspace { .items(cx) .filter_map(|item| { let id = item.id() as u64; - let item = item.to_followed_item_handle(cx)?; + let item = item.to_followable_item_handle(cx)?; let variant = item.to_state_message(cx); Some(proto::View { id,