Struct freya::prelude::GlobalMemo
pub struct GlobalMemo<T>where
T: 'static,{ /* private fields */ }
Expand description
A signal that can be accessed from anywhere in the application and created in a static
Implementations§
§impl<T> GlobalMemo<T>where
T: PartialEq + 'static,
impl<T> GlobalMemo<T>where T: PartialEq + 'static,
pub const fn new(selector: fn() -> T) -> GlobalMemo<T>where
T: PartialEq,
pub const fn new(selector: fn() -> T) -> GlobalMemo<T>where T: PartialEq,
Create a new global signal
pub fn signal(&self) -> ReadOnlySignal<T>
pub fn signal(&self) -> ReadOnlySignal<T>
Get the signal that backs this global.
pub fn origin_scope(&self) -> ScopeId
pub fn origin_scope(&self) -> ScopeId
Get the scope the signal was created in.
pub fn id(&self) -> GenerationalBoxId
pub fn id(&self) -> GenerationalBoxId
Get the generational id of the signal.
Trait Implementations§
§impl<T> Debug for GlobalMemo<T>where
T: PartialEq + Debug + 'static,
impl<T> Debug for GlobalMemo<T>where T: PartialEq + Debug + 'static,
§impl<T> Deref for GlobalMemo<T>where
T: PartialEq + Clone + 'static,
impl<T> Deref for GlobalMemo<T>where T: PartialEq + Clone + 'static,
Allow calling a signal with signal() syntax
Currently only limited to copy types, though could probably specialize for string/arc/rc
§impl<T> Display for GlobalMemo<T>where
T: PartialEq + Display + 'static,
impl<T> Display for GlobalMemo<T>where T: PartialEq + Display + 'static,
§impl<T> IntoAttributeValue for GlobalMemo<T>where
T: PartialEq + 'static + Clone + IntoAttributeValue,
impl<T> IntoAttributeValue for GlobalMemo<T>where T: PartialEq + 'static + Clone + IntoAttributeValue,
§fn into_value(self) -> AttributeValue
fn into_value(self) -> AttributeValue
Convert into an attribute value
§impl<T> PartialEq<T> for GlobalMemo<T>where
T: PartialEq + 'static,
impl<T> PartialEq<T> for GlobalMemo<T>where T: PartialEq + 'static,
§impl<T> PartialEq for GlobalMemo<T>where
T: PartialEq + 'static,
impl<T> PartialEq for GlobalMemo<T>where T: PartialEq + 'static,
§fn eq(&self, other: &GlobalMemo<T>) -> bool
fn eq(&self, other: &GlobalMemo<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.§impl<T> Readable<T> for GlobalMemo<T>where
T: PartialEq + 'static,
impl<T> Readable<T> for GlobalMemo<T>where T: PartialEq + 'static,
§fn map_ref<I, U, F>(
ref_: <GlobalMemo<T> as Readable<T>>::Ref<I>,
f: F
) -> <GlobalMemo<T> as Readable<T>>::Ref<U>where
F: FnOnce(&I) -> &U,
U: ?Sized,
fn map_ref<I, U, F>( ref_: <GlobalMemo<T> as Readable<T>>::Ref<I>, f: F ) -> <GlobalMemo<T> as Readable<T>>::Ref<U>where F: FnOnce(&I) -> &U, U: ?Sized,
Map the reference to a new type.
§fn try_map_ref<I, U, F>(
ref_: <GlobalMemo<T> as Readable<T>>::Ref<I>,
f: F
) -> Option<<GlobalMemo<T> as Readable<T>>::Ref<U>>where
F: FnOnce(&I) -> Option<&U>,
U: ?Sized,
fn try_map_ref<I, U, F>( ref_: <GlobalMemo<T> as Readable<T>>::Ref<I>, f: F ) -> Option<<GlobalMemo<T> as Readable<T>>::Ref<U>>where F: FnOnce(&I) -> Option<&U>, U: ?Sized,
Try to map the reference to a new type.
§fn read(&self) -> <GlobalMemo<T> as Readable<T>>::Ref<T>
fn read(&self) -> <GlobalMemo<T> as Readable<T>>::Ref<T>
Get the current value of the state. If this is a signal, this will subscribe the current scope to the signal. If the value has been dropped, this will panic.
§fn peek(&self) -> <GlobalMemo<T> as Readable<T>>::Ref<T>
fn peek(&self) -> <GlobalMemo<T> as Readable<T>>::Ref<T>
Get the current value of the state without subscribing to updates. If the value has been dropped, this will panic.
§fn with<O>(&self, f: impl FnOnce(&T) -> O) -> O
fn with<O>(&self, f: impl FnOnce(&T) -> O) -> O
Run a function with a reference to the value. If the value has been dropped, this will panic.
Auto Trait Implementations§
impl<T> RefUnwindSafe for GlobalMemo<T>
impl<T> Send for GlobalMemo<T>
impl<T> Sync for GlobalMemo<T>
impl<T> Unpin for GlobalMemo<T>
impl<T> UnwindSafe for GlobalMemo<T>
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T, R> ReadableOptionExt<T> for Rwhere
T: 'static,
R: Readable<Option<T>>,
impl<T, R> ReadableOptionExt<T> for Rwhere T: 'static, R: Readable<Option<T>>,
§impl<T, R> ReadableVecExt<T> for Rwhere
T: 'static,
R: Readable<Vec<T>>,
impl<T, R> ReadableVecExt<T> for Rwhere T: 'static, R: Readable<Vec<T>>,
§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere O: From<T>,
§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere O: SuperFrom<T, M>,
§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.