pub struct FetchRegistry { /* private fields */ }Expand description
HTTP plumbing: start requests away from the world thread, marshal the completed reply back onto the ECS/UI thread, and surface it to the script.
Both fetch(url, tag) (simple sugar) and http(#{...}) (general form)
flow through this single registry, dispatcher, and completion channel -
there is exactly one async delivery mechanism. The worker only ever sends
the outcome down the channel; collect_fetch_replies, running on the
world thread, moves it into PendingFetchReplies, and
fire_fetched_responses is the only place a signal / handler is touched.
That worker->UI-thread hand-off mirrors Slint’s invoke_from_event_loop
marshalling.
The registry holds the HttpDispatch every request runs on, which in turn
holds the HttpClient. A default registry dispatches
DisabledHttpClient onto a worker thread, so a build with no client
installed answers each request with the “no HTTP client” error instead of
hanging or silently dropping it. The runtime installs the client Lumen ships
(lumen-http-ureq) with FetchRegistry::with_client before the script
plugin builds; an embedder swaps in its own the same way, and a platform
with no thread to block swaps the dispatcher itself with
FetchRegistry::with_dispatch.
Implementations§
Source§impl FetchRegistry
impl FetchRegistry
Sourcepub fn with_client(client: Arc<dyn HttpClient>) -> Self
pub fn with_client(client: Arc<dyn HttpClient>) -> Self
Build a registry whose requests run on client, one worker thread per
request.
Insert it before the script plugin builds; the plugin only installs its own default when no registry is present.
Sourcepub fn with_dispatch(dispatch: Arc<dyn HttpDispatch>) -> Self
pub fn with_dispatch(dispatch: Arc<dyn HttpDispatch>) -> Self
Build a registry whose requests run on dispatch, for a platform where
a blocked worker thread is not how a request completes.
Trait Implementations§
Source§impl Component for FetchRegistry
impl Component for FetchRegistry
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>],
while immutable components will instead have [Component<Mutability = Immutable>]. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
ComponentRelationshipAccessor] required for working with relationships in dynamic contexts. Read more§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
on_add [ComponentHook] for this [Component] if one is defined.§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
on_insert [ComponentHook] for this [Component] if one is defined.§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
on_discard [ComponentHook] for this [Component] if one is defined.§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
on_remove [ComponentHook] for this [Component] if one is defined.§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
on_despawn [ComponentHook] for this [Component] if one is defined.§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper]. This is used to remap entities in contexts like scenes and entity cloning.
When deriving [Component], this is populated by annotating fields containing entities with #[entities] Read moreSource§impl Default for FetchRegistry
impl Default for FetchRegistry
impl Resource for FetchRegistry
Auto Trait Implementations§
impl Freeze for FetchRegistry
impl !RefUnwindSafe for FetchRegistry
impl Send for FetchRegistry
impl Sync for FetchRegistry
impl Unpin for FetchRegistry
impl UnsafeUnpin for FetchRegistry
impl !UnwindSafe for FetchRegistry
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
§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
§fn get_component_ids(
components: &Components,
) -> impl Iterator<Item = Option<ComponentId>>
fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>
Bundle]’s component ids. This will be None if the component has not been registered.§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().