Skip to main content

FixtureTransport

Struct FixtureTransport 

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

An in-memory transport for deterministic sessions and replay.

Implementations§

Source§

impl FixtureTransport

Source

pub fn new() -> Self

A connected, empty fixture.

Source

pub fn with(self, resource: Symbol, value: Expr) -> Self

Seed a resource value (builder form).

Source

pub fn set(&mut self, resource: Symbol, value: Expr)

Seed or replace a resource value.

Source

pub fn with_finite_stream( self, metadata: StreamMetadata, items: Vec<StreamItem>, ) -> Self

Seed a deterministic finite stream.

Source

pub fn with_push_stream(self, metadata: StreamMetadata) -> Self

Seed a push stream.

Source

pub fn set_finite_stream( &mut self, metadata: StreamMetadata, items: Vec<StreamItem>, )

Seed or replace a deterministic finite stream.

Source

pub fn set_push_stream(&mut self, metadata: StreamMetadata)

Seed or replace a push stream.

Source

pub fn mark_stream_refused( &mut self, stream_id: &Symbol, diagnostic: Symbol, ) -> Result<()>

Mark a stream as refused after a profile diagnostic.

Source

pub fn disconnect(&mut self)

Simulate connection loss.

Source

pub fn begin_reconnect(&mut self)

Simulate a reconnecting transport.

Source

pub fn reconnect(&mut self)

Simulate a restored connection.

Trait Implementations§

Source§

impl Default for FixtureTransport

Source§

fn default() -> Self

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

impl Transport for FixtureTransport

Source§

fn kind(&self) -> TransportKind

Which kind of runtime this transport connects to.
Source§

fn status(&self) -> SessionStatus

The current connection status.
Source§

fn read(&self, resource: &Symbol) -> Result<Expr>

Read the current value of a resource.
Source§

fn realize(&mut self, resource: &Symbol, operation: &Expr) -> Result<Expr>

Realize a checked operation against a resource, returning the new value (the realize_final surface). Implementations also record a ChangeEvent for the resource.
Source§

fn drain_events(&mut self) -> Vec<ChangeEvent>

Drain the pending change events (the realize_events surface).
Source§

fn stream_subscribe( &mut self, stream_id: &Symbol, ) -> Result<StreamInspectorRecord>

Subscribe to a stream and return browser-visible inspector data.
Source§

fn stream_read( &mut self, stream_id: &Symbol, limit: usize, ) -> Result<Vec<StreamItem>>

Read at most limit packets from a stream.
Source§

fn stream_push( &mut self, stream_id: &Symbol, envelope: StreamEnvelope, ) -> Result<PushResult>

Push one stream envelope.
Source§

fn stream_cancel(&mut self, stream_id: &Symbol) -> Result<()>

Cancel a stream.
Source§

fn stream_stats(&self, stream_id: &Symbol) -> Result<StreamStats>

Return current stream stats.
Source§

fn stream_inspector(&self, stream_id: &Symbol) -> Result<StreamInspectorRecord>

Return browser-visible inspector data without changing stream state.

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.

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, 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.