pub struct Ui { /* private fields */ }Expand description
Everything the handlers touch.
The queue, the runs directory and the magi home are fields rather than process-global lookups so a test drives the real router against a temp directory instead of the operator’s own history.
Implementations§
Source§impl Ui
impl Ui
Sourcepub fn new(
queue: Queue,
questions: Questions,
talks: Talks,
runs: PathBuf,
home: PathBuf,
repo: PathBuf,
) -> Self
pub fn new( queue: Queue, questions: Questions, talks: Talks, runs: PathBuf, home: PathBuf, repo: PathBuf, ) -> Self
A server over explicit paths.
Sourcepub fn open(repo: PathBuf) -> Self
pub fn open(repo: PathBuf) -> Self
The operator’s own state: <home>/queue, <home>/questions,
<home>/talks, <home>/runs.
Sourcepub fn with_merge(self, merge: Option<String>) -> Self
pub fn with_merge(self, merge: Option<String>) -> Self
The merge mode the loop should use, as the command line gave it.
A builder step rather than a seventh parameter on Ui::new, because
the override is a property of how this process was invoked and not of
where its state lives - which is all the tests that build a Ui by
hand are saying.
Sourcepub fn with_worktrees_root(self, root: PathBuf) -> Self
pub fn with_worktrees_root(self, root: PathBuf) -> Self
Where the runs’ worktrees live, when it is not the default.
The health view sizes this directory, so a test that leaves it at the default would be measuring the operator’s own machine.
Sourcepub fn router(self) -> Router
pub fn router(self) -> Router
The router, with this state baked in.
The three front-end files get one explicit route each rather than a
path parameter, so there is no traversal surface to get wrong: the set
of servable paths is the set written here. The asset route below is the
one exception and the only place in this server where a client names a
file; it is why [valid_asset_name] is checked before a path is built.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ui
impl RefUnwindSafe for Ui
impl Send for Ui
impl Sync for Ui
impl Unpin for Ui
impl UnsafeUnpin for Ui
impl UnwindSafe for Ui
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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