Skip to main content

ferroui_base/controls/
i_deferred_content.rs

1use crate::metadata::IServiceProvider;
2use crate::BoxedValue;
3use std::rc::Rc;
4
5/// Represents a deferred content: content that is built on demand, the first
6/// time it is requested.
7pub trait IDeferredContent {
8    /// Builds the deferred content. `service_provider` is the service
9    /// provider to build it with, if any; deferred resources are built with
10    /// none.
11    fn build(&self, service_provider: Option<&Rc<dyn IServiceProvider>>) -> Option<BoxedValue>;
12}
13
14/// Handles compare by identity (reference equality), so that they can be
15/// held in property and untyped values.
16impl PartialEq for dyn IDeferredContent {
17    #[inline]
18    fn eq(&self, other: &Self) -> bool {
19        std::ptr::addr_eq(self as *const Self, other as *const Self)
20    }
21}