pub struct WebRun<'a> {
pub broker: &'a Broker,
pub data_dir: &'a Path,
pub now: &'a dyn Fn() -> u64,
pub sleep: &'a dyn Fn(Duration),
pub open: &'a dyn Fn(&str),
}Expand description
What --web needs from its surroundings; tests replace the clock and
the sleep.
Fields§
§broker: &'a Broker§data_dir: &'a Path§now: &'a dyn Fn() -> u64§sleep: &'a dyn Fn(Duration)§open: &'a dyn Fn(&str)Opens the consent link in the browser (best effort; tests pass a no-op).
Implementations§
Source§impl WebRun<'_>
impl WebRun<'_>
Sourcepub fn run(
&self,
client: &CloudClient,
consent_id: &str,
print: &mut dyn FnMut(&str),
) -> Result<Record, ConsentError>
pub fn run( &self, client: &CloudClient, consent_id: &str, print: &mut dyn FnMut(&str), ) -> Result<Record, ConsentError>
Steps 1–7 for consent_id; prints the step-3 line through print.
Source§impl WebRun<'_>
impl WebRun<'_>
Sourcepub fn run_device(
&self,
client: &CloudClient,
consent_id: &str,
waiting: &mut dyn FnMut(),
) -> Result<Record, ConsentError>
pub fn run_device( &self, client: &CloudClient, consent_id: &str, waiting: &mut dyn FnMut(), ) -> Result<Record, ConsentError>
C0 2.1: answer a first share on the device approval page that just
approved this machine. Cloud approves it at once when it is exactly
the share the page showed; anything else the person answers there,
within the page’s window. waiting runs once if it has to wait.
Source§impl WebRun<'_>
impl WebRun<'_>
Sourcepub fn run_browser(
&self,
client: &CloudClient,
consent_id: &str,
opened: &mut dyn FnMut(&Value),
) -> Result<Record, ConsentError>
pub fn run_browser( &self, client: &CloudClient, consent_id: &str, opened: &mut dyn FnMut(&Value), ) -> Result<Record, ConsentError>
A first share answered in the browser for an app (rc3-70): create
the browser-bound request, hand Cloud’s answer (url,
expires_at, interval_s) to opened once, then poll until the
person answered or the request expired. A Cloud without the browser
binding (400 invalid_request naming binding) ends it as
ConsentError::BrowserUnsupported.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for WebRun<'a>
impl<'a> !Send for WebRun<'a>
impl<'a> !Sync for WebRun<'a>
impl<'a> !UnwindSafe for WebRun<'a>
impl<'a> Forget for WebRun<'a>
impl<'a> Freeze for WebRun<'a>
impl<'a> Move for WebRun<'a>
impl<'a> Unpin for WebRun<'a>
impl<'a> UnsafeUnpin for WebRun<'a>where
&'a Broker: UnsafeUnpin,
&'a Path: UnsafeUnpin,
&'a dyn Fn() -> u64: UnsafeUnpin,
&'a dyn Fn(Duration): UnsafeUnpin,
&'a dyn Fn(&str): UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more