gpui/src/app.rs 🔗
@@ -1248,7 +1248,7 @@ impl MutableAppContext {
)
}
- pub fn render_cx<V: View>(
+ pub fn build_render_context<V: View>(
&mut self,
window_id: usize,
view_id: usize,
Antonio Scandurra and Nathan Sobo created
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
gpui/src/app.rs | 2 +-
gpui/src/elements/list.rs | 8 ++++----
gpui/src/presenter.rs | 7 +++++--
3 files changed, 10 insertions(+), 7 deletions(-)
@@ -1248,7 +1248,7 @@ impl MutableAppContext {
)
}
- pub fn render_cx<V: View>(
+ pub fn build_render_context<V: View>(
&mut self,
window_id: usize,
view_id: usize,
@@ -440,13 +440,13 @@ mod tests {
let mut list = List::new(
state.clone(),
- &cx.render_cx::<TestView>(0, 0, 0., false),
+ &cx.build_render_context::<TestView>(0, 0, 0., false),
|range| elements[range].iter().copied().map(item),
)
.boxed();
let size = list.layout(
SizeConstraint::new(vec2f(0., 0.), vec2f(100., 40.)),
- &mut presenter.layout_cx(cx),
+ &mut presenter.build_layout_context(cx),
);
assert_eq!(size, vec2f(100., 40.));
assert_eq!(
@@ -473,13 +473,13 @@ mod tests {
let mut list = List::new(
state.clone(),
- &cx.render_cx::<TestView>(0, 0, 0., false),
+ &cx.build_render_context::<TestView>(0, 0, 0., false),
|range| elements[range].iter().copied().map(item),
)
.boxed();
let size = list.layout(
SizeConstraint::new(vec2f(0., 0.), vec2f(100., 40.)),
- &mut presenter.layout_cx(cx),
+ &mut presenter.build_layout_context(cx),
);
assert_eq!(size, vec2f(100., 40.));
assert_eq!(
@@ -124,12 +124,15 @@ impl Presenter {
fn layout(&mut self, size: Vector2F, cx: &mut MutableAppContext) {
if let Some(root_view_id) = cx.root_view_id(self.window_id) {
- self.layout_cx(cx)
+ self.build_layout_context(cx)
.layout(root_view_id, SizeConstraint::strict(size));
}
}
- pub fn layout_cx<'a>(&'a mut self, cx: &'a mut MutableAppContext) -> LayoutContext<'a> {
+ pub fn build_layout_context<'a>(
+ &'a mut self,
+ cx: &'a mut MutableAppContext,
+ ) -> LayoutContext<'a> {
LayoutContext {
rendered_views: &mut self.rendered_views,
parents: &mut self.parents,