DerivedWeights

Struct DerivedWeights 

Source
pub struct DerivedWeights { /* private fields */ }
Expand description

2026-09-25: Per-model memo of derived weight encodings, one map per Derivation.

Implementations§

Source§

impl DerivedWeights

Source

pub fn new() -> Self

Source

pub fn get_ptr(&self, kind: Derivation, key: u64) -> Option<u64>

2026-09-25: Memo read for a single-pointer derivation, for callers that allocate and launch between the lookup and Self::insert_ptr. A pair-valued kind returns None.

Source

pub fn insert_ptr(&self, kind: Derivation, key: u64, value: u64)

Source

pub fn get_pair(&self, kind: Derivation, key: u64) -> Option<(u64, u64)>

Source

pub fn insert_pair(&self, kind: Derivation, key: u64, value: (u64, u64))

Source

pub fn get_or_build_ptr( &self, kind: Derivation, key: u64, build: impl FnOnce() -> Result<u64>, ) -> Result<u64>

2026-09-25: Look up a single-pointer derivation, building it on a miss. A failed build stores nothing.

build runs outside the lock. If two threads race on one key, both build, the first stored value is kept and returned to both, and the loser’s value is not freed.

Source

pub fn get_or_build_pair( &self, kind: Derivation, key: u64, build: impl FnOnce() -> Result<(u64, u64)>, ) -> Result<(u64, u64)>

2026-09-25: Self::get_or_build_ptr for a pair-valued derivation.

Source

pub fn len(&self) -> usize

2026-09-25: Total memoized entries across the four maps.

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl Debug for DerivedWeights

Source§

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

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

impl Default for DerivedWeights

Source§

fn default() -> DerivedWeights

Returns the “default value” for a type. Read more
Source§

impl ModelResource<dyn GpuBackend> for DerivedWeights

2026-09-25: Release every derived allocation.

The keys are the source weights’ pointers, which the weight store owns and frees; only the values are freed here. Every free is attempted, and the first error is returned.

Source§

fn label(&self) -> &'static str

2026-09-25: Human name, used to attribute a failure in Teardown::release_all’s error.
Source§

fn release(&mut self, gpu: &dyn GpuBackend) -> Result<()>

2026-09-25: Release everything this owns. Must be idempotent.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,