pub struct RecordingInterlocutor { /* private fields */ }Expand description
Wraps a channel and records every answer a person gives.
Owns the channel it wraps and hands back a shared handle on the list, rather
than borrowing: the wrapped channel is moved into the run, so there is no
borrow left out here to read the recording from afterwards. Single-threaded
by construction — the interpreter asks one question at a time and waits — so
Rc<RefCell<_>> is the honest representation rather than a compromise, the
same reading the supervisor’s guest already takes.
Implementations§
Source§impl RecordingInterlocutor
impl RecordingInterlocutor
Sourcepub fn new(
inner: HumanChannel,
) -> (RecordingInterlocutor, Rc<RefCell<Vec<Consultation>>>)
pub fn new( inner: HumanChannel, ) -> (RecordingInterlocutor, Rc<RefCell<Vec<Consultation>>>)
The wrapper, and the list it will fill.
Trait Implementations§
Source§impl Interlocutor for RecordingInterlocutor
impl Interlocutor for RecordingInterlocutor
Source§fn approve(&mut self, request: &ApprovalRequest) -> bool
fn approve(&mut self, request: &ApprovalRequest) -> bool
Whether a gated action may proceed.
Source§fn consult(&mut self, request: &ConsultRequest) -> Result<String, ConsultError>
fn consult(&mut self, request: &ConsultRequest) -> Result<String, ConsultError>
Put a question to a person and return what they said. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for RecordingInterlocutor
impl !Send for RecordingInterlocutor
impl !Sync for RecordingInterlocutor
impl !UnwindSafe for RecordingInterlocutor
impl Freeze for RecordingInterlocutor
impl Unpin for RecordingInterlocutor
impl UnsafeUnpin for RecordingInterlocutor
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