pub struct BaseCx<'a> { /* private fields */ }
Expand description
A base context that is shared between all other contexts.
Implementations§
Source§impl<'a> BaseCx<'a>
impl<'a> BaseCx<'a>
Sourcepub fn new(contexts: &'a mut Contexts, proxy: &'a mut CommandProxy) -> Self
pub fn new(contexts: &'a mut Contexts, proxy: &'a mut CommandProxy) -> Self
Create a new base context.
Sourcepub fn measure_paragraph(&mut self, paragraph: &Paragraph, width: f32) -> Size
pub fn measure_paragraph(&mut self, paragraph: &Paragraph, width: f32) -> Size
Measure a paragraph.
Sourcepub fn layout_paragraph(
&mut self,
paragraph: &Paragraph,
width: f32,
) -> Vec<TextLayoutLine>
pub fn layout_paragraph( &mut self, paragraph: &Paragraph, width: f32, ) -> Vec<TextLayoutLine>
Layout a paragraph.
Sourcepub fn proxy(&self) -> CommandProxy
pub fn proxy(&self) -> CommandProxy
Get the CommandProxy
.
Sourcepub fn spawn_async(&mut self, future: impl Future<Output = ()> + Send + 'static)
pub fn spawn_async(&mut self, future: impl Future<Output = ()> + Send + 'static)
Spawn a future.
Sourcepub fn cmd_async<T: Any + Send>(
&self,
future: impl Future<Output = T> + Send + 'static,
)
pub fn cmd_async<T: Any + Send>( &self, future: impl Future<Output = T> + Send + 'static, )
Spawn a future sending a command when it completes.
Sourcepub fn contexts_mut(&mut self) -> &mut Contexts
pub fn contexts_mut(&mut self) -> &mut Contexts
Get a mutable reference to the Contexts
.
Sourcepub fn insert_context<T: Any>(&mut self, context: T) -> Option<T>
pub fn insert_context<T: Any>(&mut self, context: T) -> Option<T>
Insert a context.
Sourcepub fn contains_context<T: Any>(&self) -> bool
pub fn contains_context<T: Any>(&self) -> bool
Check if a context is contained.
Sourcepub fn remove_context<T: Any>(&mut self) -> Option<T>
pub fn remove_context<T: Any>(&mut self) -> Option<T>
Remove a context.
Sourcepub fn get_context<T: Any>(&self) -> Option<&T>
pub fn get_context<T: Any>(&self) -> Option<&T>
Get a context.
Sourcepub fn get_context_mut<T: Any>(&mut self) -> Option<&mut T>
pub fn get_context_mut<T: Any>(&mut self) -> Option<&mut T>
Get a mutable context.
Sourcepub fn context_mut<T: Any>(&mut self) -> &mut T
pub fn context_mut<T: Any>(&mut self) -> &mut T
Sourcepub fn context_or_default<T: Any + Default>(&mut self) -> &mut T
pub fn context_or_default<T: Any + Default>(&mut self) -> &mut T
Get a context or insert a default
.
Auto Trait Implementations§
impl<'a> Freeze for BaseCx<'a>
impl<'a> !RefUnwindSafe for BaseCx<'a>
impl<'a> !Send for BaseCx<'a>
impl<'a> !Sync for BaseCx<'a>
impl<'a> Unpin for BaseCx<'a>
impl<'a> !UnwindSafe for BaseCx<'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