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>
impl<REQ: 'static, RSP: 'static> SeqCtx<REQ, RSP>
Sourcepub fn name(&self) -> &'static str
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.
Sourcepub fn rng(&self) -> Rng
pub fn rng(&self) -> Rng
A seeded RNG, so a run reproduces. pyuvm’s sequences reach for the
global random module and do not.
pub fn info(&self, msg: &str)
pub fn warning(&self, msg: &str)
pub fn error(&self, msg: &str)
Sourcepub async fn start_item(&mut self, _item: &mut REQ) -> Result<(), SeqError>
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.
Sourcepub async fn finish_item(&mut self, item: REQ) -> Result<TxnId, SeqError>
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.
Sourcepub fn try_get_response(&mut self, txn_id: Option<TxnId>) -> Option<RSP>
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.
Sourcepub async fn get_response(&mut self, txn_id: Option<TxnId>) -> RSP
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.