Skip to main content

HeaderQuestions

Struct HeaderQuestions 

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

The header source of a host that answers over a pull channel (the FFI event queue, the conformance shim’s stdio). Each read asks the host one question under a fresh request id and blocks until Self::provide answers it, HEADER_ANSWER_WAIT_MS pass on the clock, or Self::close runs. clock is monotonic milliseconds; a waiter re-checks it on every answer, every Self::recheck, and at its deadline in real time.

Implementations§

Source§

impl HeaderQuestions

Source

pub fn new( ask: impl Fn(u64, &HeaderContext, Option<&[(String, String)]>) + Send + Sync + 'static, clock: impl Fn() -> i64 + Send + Sync + 'static, ) -> Arc<Self> ⓘ

Source

pub fn source(self: &Arc<Self>) -> HeaderSource

The header source whose reads ask these questions.

Source

pub fn provide(&self, id: u64, headers: &Value) -> Result<(), TransportError>

Answer question id with headers: an object of string values, or null when the host cannot produce headers. An answer to an unknown or expired id is ignored.

Source

pub fn is_open(&self, id: u64) -> bool

Whether question id still waits for an answer: asked, unanswered, and within its bound. A host channel skips a question that is not.

Source

pub fn recheck(&self)

Wake every waiter to re-check its deadline after the clock moved.

Source

pub fn close(&self)

Fail every open question and every later read with client.closed.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.