pub struct ToolDriver { /* private fields */ }Expand description
The driver that runs the repository’s own majordomus capture session.
It finds the tool the way a provider hook’s shim does and in the same order — the
repository’s bin/majordomus, an installation under .majordomus/, then whatever is on
the path — because a second resolution order would be a second answer to “which tool is
this repository’s”, and the shims are the ones that have been right about it for months.
When no tool is found it records nothing and says why, in the episode’s own field:
use majordomus_cli::episodes::{EpisodeDriver, ToolDriver};
let empty = std::env::temp_dir().join("mj-tooldriver-doctest-no-tool");
std::env::remove_var("PATH"); // nor any majordomus on the path
let said = ToolDriver::new(&empty).open("generic", "t1");
assert!(said.starts_with("no episode was recorded"), "{said}");Implementations§
Source§impl ToolDriver
impl ToolDriver
Sourcepub fn new(root: impl Into<PathBuf>) -> Self
pub fn new(root: impl Into<PathBuf>) -> Self
A driver for the repository at root. Nothing is resolved or run here: the tool is
looked for on every event, so a bin/majordomus built after the server started is the
one used.
use majordomus_cli::episodes::ToolDriver;
let driver = ToolDriver::new("/srv/repo");
assert!(format!("{driver:?}").contains("/srv/repo"));Trait Implementations§
Source§impl Clone for ToolDriver
impl Clone for ToolDriver
Source§fn clone(&self) -> ToolDriver
fn clone(&self) -> ToolDriver
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ToolDriver
impl Debug for ToolDriver
Source§impl EpisodeDriver for ToolDriver
impl EpisodeDriver for ToolDriver
Source§fn open(&self, provider: &str, external_id: &str) -> String
fn open(&self, provider: &str, external_id: &str) -> String
Open the episode for
external_id under provider. Returns what to record in
ConnectionEpisode::repository — a description of what happened, successful or not.
It is called once per episode, on the first attach; a resume does not call it again. Read moreAuto Trait Implementations§
impl Freeze for ToolDriver
impl RefUnwindSafe for ToolDriver
impl Send for ToolDriver
impl Sync for ToolDriver
impl Unpin for ToolDriver
impl UnsafeUnpin for ToolDriver
impl UnwindSafe for ToolDriver
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