pub struct WindowContext<'a> { /* private fields */ }Expand description
窗口初始化闭包上下文(在 open_window 回调中提供 cx.new(|cx| ...) 与子视图挂载能力)。
Implementations§
Source§impl<'a> WindowContext<'a>
impl<'a> WindowContext<'a>
Sourcepub fn new<V: View>(&mut self, build: impl FnOnce(&mut Self) -> V) -> Handle<V>
pub fn new<V: View>(&mut self, build: impl FnOnce(&mut Self) -> V) -> Handle<V>
构造并挂载窗口根视图(参照 gpui-kit |cx| cx.new(|_| Example) 写法)。
Sourcepub fn insert_view<V: View>(&mut self, view: V) -> Handle<V>
pub fn insert_view<V: View>(&mut self, view: V) -> Handle<V>
注册一个独立的子视图(L2 局部重排边界),返回其 Handle<V>。
Sourcepub fn mount_root<V: View>(&mut self, view: V) -> Handle<V>
pub fn mount_root<V: View>(&mut self, view: V) -> Handle<V>
直接挂载已构造好的根视图实例。
Sourcepub fn engine(&self) -> &VeloxEngine
pub fn engine(&self) -> &VeloxEngine
获取当前窗口绑定的 VeloxEngine 只读引用。
Sourcepub fn engine_mut(&mut self) -> &mut VeloxEngine
pub fn engine_mut(&mut self) -> &mut VeloxEngine
获取当前窗口绑定的 VeloxEngine 可变引用(可用于挂载复合子视图、设置初始状态或派生启动任务)。
Sourcepub fn scheduler_name(&self) -> &'static str
pub fn scheduler_name(&self) -> &'static str
返回当前引擎绑定的调度器名称。
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for WindowContext<'a>
impl<'a> !Send for WindowContext<'a>
impl<'a> !Sync for WindowContext<'a>
impl<'a> !UnwindSafe for WindowContext<'a>
impl<'a> Forget for WindowContext<'a>
impl<'a> Freeze for WindowContext<'a>
impl<'a> Move for WindowContext<'a>
impl<'a> Unpin for WindowContext<'a>
impl<'a> UnsafeUnpin for WindowContext<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
当
condition 为 true 时执行闭包修饰自身,否则原样返回。Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Self
fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
根据
condition 在两个修饰分支之间二选一。Source§fn when_some<O>(
self,
option: Option<O>,
then: impl FnOnce(Self, O) -> Self,
) -> Self
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。