pub struct MockScript { /* private fields */ }Available on crate feature
test-utils only.Expand description
The scripted completion wire: its payload is the request, and each frame
is a scripted step its decoder writes through the completion writer’s
part handles, as any wire’s decoder does. A runtime that answers from a
script (MockRuntime, or a test’s own) is its transport.
Implementations§
Source§impl MockScript
impl MockScript
Sourcepub fn new(name: impl Into<String>) -> MockScript
Available on crate features test-utils only.
pub fn new(name: impl Into<String>) -> MockScript
test-utils only.A scripted wire named name, as records and telemetry name it, with
default capabilities.
Sourcepub fn with_id(self, id: impl Into<String>) -> MockScript
Available on crate features test-utils only.
pub fn with_id(self, id: impl Into<String>) -> MockScript
test-utils only.The same wire, addressing the model id.
Sourcepub fn with_capabilities(self, capabilities: Capabilities) -> MockScript
Available on crate features test-utils only.
pub fn with_capabilities(self, capabilities: Capabilities) -> MockScript
test-utils only.The same wire, reporting capabilities.
Trait Implementations§
Source§impl Clone for MockScript
impl Clone for MockScript
Source§fn clone(&self) -> MockScript
fn clone(&self) -> MockScript
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MockScript
impl Debug for MockScript
Source§impl Default for MockScript
impl Default for MockScript
Source§fn default() -> MockScript
fn default() -> MockScript
Returns the “default value” for a type. Read more
impl Eq for MockScript
Source§impl PartialEq for MockScript
impl PartialEq for MockScript
impl StructuralPartialEq for MockScript
Source§impl Transport<MockScript> for MockRuntime
impl Transport<MockScript> for MockRuntime
Source§fn send(
&self,
request: CompletionRequest,
exchange: Exchange,
) -> Opening<MockFrame> ⓘ
fn send( &self, request: CompletionRequest, exchange: Exchange, ) -> Opening<MockFrame> ⓘ
Open the reply to one payload. Nothing is sent until the opening is
first polled. A payload the transport cannot send in the exchange’s
mode fails the opening; a failure after the reply opened is its last
frame.
Source§impl Wire for MockScript
impl Wire for MockScript
Source§fn encode(
&self,
request: CompletionRequest,
_mode: Mode,
) -> Result<CompletionRequest, EncodeError>
fn encode( &self, request: CompletionRequest, _mode: Mode, ) -> Result<CompletionRequest, EncodeError>
A completion replays only the reasoning this runtime issued, as every completion wire’s encode scopes it.
Source§type Op = Completion
type Op = Completion
The operation this wire performs.
Source§type Payload = CompletionRequest
type Payload = CompletionRequest
What
Self::encode produces for the transport to send.Source§type Decoder<'id> = MockDecoder<'id>
type Decoder<'id> = MockDecoder<'id>
The decoder for one of its replies, branded with that reply.
Source§fn describe(&self) -> Descriptor<'_>
fn describe(&self) -> Descriptor<'_>
What the wire says about itself.
Source§fn decoder<'id>(&self) -> MockDecoder<'id>
fn decoder<'id>(&self) -> MockDecoder<'id>
A fresh decoder for one reply.
Auto Trait Implementations§
impl Freeze for MockScript
impl RefUnwindSafe for MockScript
impl Send for MockScript
impl Sync for MockScript
impl Unpin for MockScript
impl UnsafeUnpin for MockScript
impl UnwindSafe for MockScript
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
Mutably borrows from an owned value. Read more
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§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
Compare self to
key and return true if they are equal.