Skip to main content

SeqCtx

Struct SeqCtx 

Source
pub struct SeqCtx<REQ: 'static, RSP: 'static = REQ> { /* private fields */ }
Expand description

What a running sequence is handed. Its equivalent of a component’s crate::RustdvCtx: it can log, it has a seeded RNG, and it knows its sequencer — if it has one.

Implementations§

Source§

impl<REQ: 'static, RSP: 'static> SeqCtx<REQ, RSP>

Source

pub fn name(&self) -> &'static str

The sequence’s name — the type name unless one was set (D98). For reading only: nothing is looked up by it.

Source

pub fn rng(&self) -> Rng

A seeded RNG, so a run reproduces. pyuvm’s sequences reach for the global random module and do not.

Source

pub fn info(&self, msg: &str)

Source

pub fn warning(&self, msg: &str)

Source

pub fn error(&self, msg: &str)

Source

pub async fn start_item(&mut self, _item: &mut REQ) -> Result<(), SeqError>

Enqueue this item and block until its turn comes. Returns with the driver committed and waiting: set the fields now.

Source

pub async fn finish_item(&mut self, item: REQ) -> Result<TxnId, SeqError>

Hand the (now filled) item over and block until the driver releases it. Returns the ticket, for get_response.

Source

pub fn try_get_response(&mut self, txn_id: Option<TxnId>) -> Option<RSP>

Ask whether an answer is ready, without waiting. None takes whatever is next; Some(id) looks for that ticket only.

This is what a sequence with several requests outstanding polls with — the equivalent of checking the board for your number rather than standing at the counter.

Source

pub async fn get_response(&mut self, txn_id: Option<TxnId>) -> RSP

Wait for an answer. None takes whatever is next; Some(id) waits for that ticket however many others arrive first.

Auto Trait Implementations§

§

impl<REQ, RSP = REQ> !RefUnwindSafe for SeqCtx<REQ, RSP>

§

impl<REQ, RSP = REQ> !Send for SeqCtx<REQ, RSP>

§

impl<REQ, RSP = REQ> !Sync for SeqCtx<REQ, RSP>

§

impl<REQ, RSP = REQ> !UnwindSafe for SeqCtx<REQ, RSP>

§

impl<REQ, RSP> Freeze for SeqCtx<REQ, RSP>

§

impl<REQ, RSP> Unpin for SeqCtx<REQ, RSP>

§

impl<REQ, RSP> UnsafeUnpin for SeqCtx<REQ, RSP>

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.