Skip to main content

MockBackendStreams

Struct MockBackendStreams 

Source
pub struct MockBackendStreams {
    pub pending: Option<u32>,
    pub capacity: u32,
}
Expand description

A test-only fuel_backend_contract::backend::BackendStreams handle reporting a fixed (pending_work_count, slot_capacity) — the simulated live-load signal C2’s tests inject in place of a real device. Lives here (not behind #[cfg(test)]) so the route-picker + bridge tests can build a fake load lookup without re-deriving the trait wiring.

Fields§

§pending: Option<u32>

What pending_work_count() reports. None = “I can’t measure” (a streaming backend with no depth available) ⇒ tier 0.

§capacity: u32

What slot_capacity() reports.

Implementations§

Source§

impl MockBackendStreams

Source

pub fn new(pending: Option<u32>, capacity: u32) -> Self

A handle reporting pending in-flight ops against capacity slots.

Trait Implementations§

Source§

impl BackendRuntime for MockBackendStreams

Source§

fn available_bytes(&self) -> Option<u64>

Bytes currently available for new allocations on this backend’s device. None when the backend genuinely cannot measure (no OS query exposed, no vendor API supports it). Read more
Source§

fn total_bytes(&self) -> Option<u64>

Total memory on this backend’s device. Static after first call; implementations cache unconditionally. None for backends with unbounded notional capacity (e.g. Reference returns Some(u64::MAX), or None if the backend prefers to advertise “unknowable”).
Source§

fn as_backend_streams(&self) -> Option<&dyn BackendStreams>

Tier-2 upcast seam: a runtime handle that also exposes a deferred-execution queue model returns Some(self) so a selector holding only a &dyn BackendRuntime (the type the route picker’s BackendRuntimeLookup hands out) can reach the BackendStreams live-load surface without naming the concrete handle type. Read more
Source§

fn would_fit(&self, size: u64) -> FitStatus

Predictive fit-check: would an allocation of size bytes likely succeed given current state? Returns FitStatus::Tight when projected post-allocation usage crosses the pressure threshold (default 0.85 of total). Read more
Source§

impl BackendStreams for MockBackendStreams

Source§

fn pending_work_count(&self) -> Option<u32>

Number of slots (streams / queues / command buffers) currently busy with submitted-but-not-yet-finished work, for this handle’s device. None when the backend dispatches synchronously and has no queue concept (selectors then have no load signal — fall back to static cost, never treat None as “idle”).
Source§

fn slot_capacity(&self) -> u32

Maximum concurrent in-flight work this backend advertises. Used by the runtime route picker for load tiering (count / slot_capacity) and dispatch lookahead sizing.
Source§

fn flush(&self) -> Result<()>

Block until all submitted work on this backend’s slots has completed. Used at realize boundaries and by training-loop barriers (gradient accumulation, optimizer step).

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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