What an atom's read gets. Calling it (get(atom)) or
get.get(atom) reads atom and makes the reader depend on it;
once reads without depending. Once the build it belongs to is
replaced, the context only reads (updates and subscriptions are
ignored).
Attributes#
| Attribute | Type | Description |
|---|---|---|
registry | AtomRegistryService |
Functions#
__call__#
__call__[A](atom) -> A| Parameter | Type | Description |
|---|---|---|
atom | Atom[A] |
Returns A
def __call__[A](self, atom: Atom[A], /) -> A: ...get#
get[A](atom) -> A| Parameter | Type | Description |
|---|---|---|
atom | Atom[A] |
Returns A
def get[A](self, atom: Atom[A], /) -> A: ...once#
once[A](atom) -> A| Parameter | Type | Description |
|---|---|---|
atom | Atom[A] |
Returns A
def once[A](self, atom: Atom[A], /) -> A: ...result#
result[A, E](atom, /, *, suspend_on_waiting=False) -> Effect[A, E]The atom's value as an effect (depending on it): its success or
failure, waiting while it is Initial (or waiting, with
suspend_on_waiting).
| Parameter | Type | Description |
|---|---|---|
atom | Atom[AsyncResult[A, E]] | |
suspend_on_waiting | bool = False |
Returns Effect[A, E]
def result[A, E](
self, atom: Atom[AsyncResult[A, E]], /, *, suspend_on_waiting: bool = False
) -> Effect[A, E]:
"""The atom's value as an effect (depending on it): its success or
failure, waiting while it is ``Initial`` (or waiting, with
``suspend_on_waiting``)."""
...result_once#
result_once[A, E](atom, /, *, suspend_on_waiting=False) -> Effect[A, E]| Parameter | Type | Description |
|---|---|---|
atom | Atom[AsyncResult[A, E]] | |
suspend_on_waiting | bool = False |
Returns Effect[A, E]
def result_once[A, E](
self, atom: Atom[AsyncResult[A, E]], /, *, suspend_on_waiting: bool = False
) -> Effect[A, E]: ...some#
some[A](atom) -> Effect[A]| Parameter | Type | Description |
|---|---|---|
atom | Atom[Option[A]] |
Returns Effect[A]
def some[A](self, atom: Atom[Option[A]], /) -> Effect[A]: ...some_once#
some_once[A](atom) -> Effect[A]| Parameter | Type | Description |
|---|---|---|
atom | Atom[Option[A]] |
Returns Effect[A]
def some_once[A](self, atom: Atom[Option[A]], /) -> Effect[A]: ...add_finalizer#
add_finalizer(f) -> NoneRun f when this build is replaced or the atom removed.
| Parameter | Type | Description |
|---|---|---|
f | Callable[[], None] |
def add_finalizer(self, f: Callable[[], None], /) -> None:
"""Run ``f`` when this build is replaced or the atom removed."""
...mount#
mount(atom) -> NoneKeep atom mounted while this build lasts.
| Parameter | Type | Description |
|---|---|---|
atom | Atom[Any] |
def mount(self, atom: Atom[Any], /) -> None:
"""Keep ``atom`` mounted while this build lasts."""
...refresh#
refresh(atom) -> None| Parameter | Type | Description |
|---|---|---|
atom | Atom[Any] |
def refresh(self, atom: Atom[Any], /) -> None: ...refresh_self#
refresh_self() -> Nonedef refresh_self(self) -> None: ...self#
self() -> Option[Any]This atom's current value, if it has one.
Returns Option[Any]
def self(self) -> Option[Any]:
"""This atom's current value, if it has one."""
...set_self#
set_self(value) -> NoneReplace this atom's value (from a callback or a fiber).
| Parameter | Type | Description |
|---|---|---|
value | Any |
def set_self(self, value: Any, /) -> None:
"""Replace this atom's value (from a callback or a fiber)."""
...set#
set[W](atom, value) -> None| Parameter | Type | Description |
|---|---|---|
atom | Writable[Any, W] | |
value | W |
def set[W](self, atom: Writable[Any, W], value: W, /) -> None: ...set_result#
set_result[A, E, W](atom, value) -> Effect[A, E]| Parameter | Type | Description |
|---|---|---|
atom | Writable[AsyncResult[A, E], W] | |
value | W |
Returns Effect[A, E]
def set_result[A, E, W](
self, atom: Writable[AsyncResult[A, E], W], value: W, /
) -> Effect[A, E]: ...stream#
stream[A](atom, /, *, without_initial_value=False) -> Stream[A]| Parameter | Type | Description |
|---|---|---|
atom | Atom[A] | |
without_initial_value | bool = False |
Returns Stream[A]
def stream[A](self, atom: Atom[A], /, *, without_initial_value: bool = False) -> Stream[A]: ...stream_result#
stream_result[A, E](atom, /, *, without_initial_value=False) -> Stream[A, E]| Parameter | Type | Description |
|---|---|---|
atom | Atom[AsyncResult[A, E]] | |
without_initial_value | bool = False |
Returns Stream[A, E]
def stream_result[A, E](
self, atom: Atom[AsyncResult[A, E]], /, *, without_initial_value: bool = False
) -> Stream[A, E]: ...subscribe#
subscribe[A](atom, f, /, *, immediate=False) -> None| Parameter | Type | Description |
|---|---|---|
atom | Atom[A] | |
f | Callable[[A], None] | |
immediate | bool = False |
def subscribe[A](
self, atom: Atom[A], f: Callable[[A], None], /, *, immediate: bool = False
) -> None: ...