pub struct ThemeExtensions { /* private fields */ }Expand description
A persistent, typed extension map: any 'static + Send + Sync type can be
attached once (a later insert of the same type replaces
it) and recovered by type via get.
Send + Sync bounds match crate::theme::Theme’s own crossing of
frust-shell-common’s process-global Mutex<OverrideSlot> (see that
module’s thread contract) — an extension type that isn’t Send + Sync
simply can’t be inserted, a compile-time guarantee rather than a runtime
one.
Implementations§
Source§impl ThemeExtensions
impl ThemeExtensions
Sourcepub fn insert<T: Any + Send + Sync>(&mut self, ext: T)
pub fn insert<T: Any + Send + Sync>(&mut self, ext: T)
Attach ext, keyed by its concrete type T. A later insert::<T>
call replaces whatever T was previously attached (last write wins,
mirroring HashMap::insert).
Sourcepub fn get<T: Any + Send + Sync>(&self) -> Option<&T>
pub fn get<T: Any + Send + Sync>(&self) -> Option<&T>
Recover the attached T, or None if nothing of that type was ever
inserted — never a panic on a type that isn’t there.
Trait Implementations§
Source§impl Clone for ThemeExtensions
impl Clone for ThemeExtensions
Source§impl Debug for ThemeExtensions
impl Debug for ThemeExtensions
Source§impl Default for ThemeExtensions
impl Default for ThemeExtensions
Auto Trait Implementations§
impl !RefUnwindSafe for ThemeExtensions
impl !UnwindSafe for ThemeExtensions
impl Freeze for ThemeExtensions
impl Send for ThemeExtensions
impl Sync for ThemeExtensions
impl Unpin for ThemeExtensions
impl UnsafeUnpin for ThemeExtensions
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<T> Brush for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.