pub struct RegisteredDependency {
pub name: String,
pub crate_name: String,
pub module_path: String,
pub constructor: DependencyConstructor,
pub dependencies: Vec<String>,
pub scope: DepScope,
pub worker_fn: Option<WorkerReconstructor>,
pub cloneable_codec: Option<CloneableCodec>,
pub hosted_codec: Option<CloneableCodec>,
pub rpc_factory: Option<RpcFactory>,
pub companions: Vec<String>,
}Fields§
§name: String§crate_name: String§module_path: String§constructor: DependencyConstructor§dependencies: Vec<String>§scope: DepScopeSharing strategy declared on the constructor. Defaults to
DepScope::Shared for backward compatibility.
worker_fn: Option<WorkerReconstructor>Worker-side reconstructor for Cloneable and Hosted deps
(None otherwise). For Cloneable the wire payload IS the dep value;
for Hosted the wire payload is the descriptor passed to
HostedDep::from_descriptor.
cloneable_codec: Option<CloneableCodec>Wire-bytes codec for Cloneable deps (None otherwise). The codec
shape is shared with Self::hosted_codec but the runtime dispatches
on whichever field is populated.
hosted_codec: Option<CloneableCodec>Descriptor-bytes codec for Hosted deps (None otherwise). Same
shape as Self::cloneable_codec; the codec encodes the value
returned by HostedDep::descriptor
into wire bytes on the parent (where the owner lives), and decodes
those bytes in the worker before they are passed to the registered
worker reconstructor.
rpc_factory: Option<RpcFactory>Factories for HostedRpc deps (None otherwise). The parent uses
RpcFactory::owner_into_cell to extract the HostedRpcOwnerCell
returned by the constructor; the worker uses RpcFactory::build_stub
to construct its Stub from a fresh HostedRpcChannel.
companions: Vec<String>Planner-only sibling dep names that must be retained together
with this dep during pruning. Unlike dependencies, companions
are not real dependency edges — no constructor argument is
derived from a companion, and no topological ordering is
implied. The pruner simply treats companions as mutually
reachable: if any companion in a group is in the keep-set, the
whole group is retained.
Currently set by the #[test_dep(scope = Hosted, worker = both(T))]
macro lowering, which registers two paired dep entries (the
Hosted owner view and the HostedRpc stub view) backed by the
same parent-side Arc<HostedBothShared> cache. The async
flavour of that lowering has a sync resolver on the stub side
that assumes the Hosted side has already populated the shared
cache; if pruning ever dropped the Hosted half because the
selected tests only parameterised on the stub view, that
resolver would panic. Pairing the two as companions guarantees
the Hosted half is retained whenever either half is needed.
Implementations§
Source§impl RegisteredDependency
impl RegisteredDependency
Construct a Shared (legacy / default-scope) dependency. Preserves the
pre-scopes constructor signature so downstream code that built
RegisteredDependency directly keeps compiling.
Source§impl RegisteredDependency
impl RegisteredDependency
pub fn crate_and_module(&self) -> String
Sourcepub fn qualified_id(&self) -> String
pub fn qualified_id(&self) -> String
Fully-qualified identifier used for cross-process bookkeeping of
Cloneable dependencies. The shape is {crate_name}::{module_path}::{name}
with empty segments dropped, so two deps with the same name registered
in different modules get distinct identifiers.
Trait Implementations§
Source§impl Clone for RegisteredDependency
impl Clone for RegisteredDependency
Source§fn clone(&self) -> RegisteredDependency
fn clone(&self) -> RegisteredDependency
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RegisteredDependency
impl Debug for RegisteredDependency
Source§impl Hash for RegisteredDependency
impl Hash for RegisteredDependency
Source§impl PartialEq for RegisteredDependency
impl PartialEq for RegisteredDependency
Source§fn eq(&self, other: &RegisteredDependency) -> bool
fn eq(&self, other: &RegisteredDependency) -> bool
self and other values to be equal, and is used by ==.impl Eq for RegisteredDependency
Auto Trait Implementations§
impl Freeze for RegisteredDependency
impl !RefUnwindSafe for RegisteredDependency
impl Send for RegisteredDependency
impl Sync for RegisteredDependency
impl Unpin for RegisteredDependency
impl UnsafeUnpin for RegisteredDependency
impl !UnwindSafe for RegisteredDependency
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.