Skip to main content

RegisteredDependency

Struct RegisteredDependency 

Source
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: DepScope

Sharing 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

Source

pub fn new_shared( name: String, crate_name: String, module_path: String, constructor: DependencyConstructor, dependencies: Vec<String>, ) -> 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

Source

pub fn crate_and_module(&self) -> String

Source

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

Source§

fn clone(&self) -> RegisteredDependency

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RegisteredDependency

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Hash for RegisteredDependency

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for RegisteredDependency

Source§

fn eq(&self, other: &RegisteredDependency) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for RegisteredDependency

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TryClone for T
where T: Clone,

Source§

fn try_clone(&self) -> Result<T, Error>

Clones self, possibly returning an error.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.