Rename build_view to new_view and build_model to new_model

The word "new" is shorter and blends in with `new` constructors that are common
in Rust. Been meaning to do this for a while.
This commit is contained in:
Nathan Sobo
2024-01-01 17:42:01 -07:00
parent 219999cd8d
commit db1cf8f6e1
97 changed files with 470 additions and 494 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ impl ContextMenu {
cx: &mut WindowContext,
f: impl FnOnce(Self, &mut WindowContext) -> Self,
) -> View<Self> {
cx.build_view(|cx| {
cx.new_view(|cx| {
let focus_handle = cx.focus_handle();
let _on_blur_subscription = cx.on_blur(&focus_handle, |this: &mut ContextMenu, cx| {
this.cancel(&menu::Cancel, cx)
+3 -3
View File
@@ -13,7 +13,7 @@ pub struct Tooltip {
impl Tooltip {
pub fn text(title: impl Into<SharedString>, cx: &mut WindowContext) -> AnyView {
cx.build_view(|_cx| Self {
cx.new_view(|_cx| Self {
title: title.into(),
meta: None,
key_binding: None,
@@ -26,7 +26,7 @@ impl Tooltip {
action: &dyn Action,
cx: &mut WindowContext,
) -> AnyView {
cx.build_view(|cx| Self {
cx.new_view(|cx| Self {
title: title.into(),
meta: None,
key_binding: KeyBinding::for_action(action, cx),
@@ -40,7 +40,7 @@ impl Tooltip {
meta: impl Into<SharedString>,
cx: &mut WindowContext,
) -> AnyView {
cx.build_view(|cx| Self {
cx.new_view(|cx| Self {
title: title.into(),
meta: Some(meta.into()),
key_binding: action.and_then(|action| KeyBinding::for_action(action, cx)),