pub struct WorkingDirectoryPool { /* private fields */ }Implementations§
Source§impl WorkingDirectoryPool
impl WorkingDirectoryPool
Sourcepub fn lock<'t>(&'t self, locker: &str) -> Result<WorkingDirectoryPoolGuard<'t>>
pub fn lock<'t>(&'t self, locker: &str) -> Result<WorkingDirectoryPoolGuard<'t>>
Get exclusive lock, but sharing self
Sourcepub fn lock_mut<'t>(
&'t mut self,
locker: &str,
) -> Result<WorkingDirectoryPoolGuardMut<'t>>
pub fn lock_mut<'t>( &'t mut self, locker: &str, ) -> Result<WorkingDirectoryPoolGuardMut<'t>>
Get exclusive lock, for exclusive access to self
Sourcepub fn open(
context: WorkingDirectoryPoolContext,
create_dir_if_not_exists: bool,
omit_check: bool,
) -> Result<WorkingDirectoryPoolAndLock>
pub fn open( context: WorkingDirectoryPoolContext, create_dir_if_not_exists: bool, omit_check: bool, ) -> Result<WorkingDirectoryPoolAndLock>
omit_check is passed on to WorkingDirectory::open (it
should only be set to true for dir listings).
Sourcepub fn get_working_directory(
&self,
working_directory_id: WorkingDirectoryId,
) -> Option<&WorkingDirectory>
pub fn get_working_directory( &self, working_directory_id: WorkingDirectoryId, ) -> Option<&WorkingDirectory>
Also see the method on WorkingDirectoryPoolGuard!
Sourcepub fn get_working_directory_path(
&self,
working_directory_id: WorkingDirectoryId,
) -> WorkingDirectoryPath
pub fn get_working_directory_path( &self, working_directory_id: WorkingDirectoryId, ) -> WorkingDirectoryPath
For cases where the working directory existing does not matter
Sourcepub fn get_working_directory_mut(
&mut self,
working_directory_id: WorkingDirectoryId,
) -> Option<&mut WorkingDirectory>
pub fn get_working_directory_mut( &mut self, working_directory_id: WorkingDirectoryId, ) -> Option<&mut WorkingDirectory>
Also see the method on WorkingDirectoryPoolGuard!
pub fn base_dir(&self) -> &Arc<WorkingDirectoryPoolBaseDir>
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
The value from the configuration as usize. Guaranteed to be
at least 1.
pub fn git_url(&self) -> &GitUrl
Sourcepub fn all_entries(
&self,
) -> impl Iterator<Item = (WorkingDirectoryId, &WorkingDirectory)>
pub fn all_entries( &self, ) -> impl Iterator<Item = (WorkingDirectoryId, &WorkingDirectory)>
This includes working dirs with errors, that (normally) must
be left aside and not used for processing! The returned
entries are sorted by WorkingDirectoryId
pub fn all_entries_mut( &mut self, ) -> impl Iterator<Item = (WorkingDirectoryId, &mut WorkingDirectory)>
Sourcepub fn active_entries(
&self,
) -> impl Iterator<Item = (WorkingDirectoryId, &WorkingDirectory)>
pub fn active_entries( &self, ) -> impl Iterator<Item = (WorkingDirectoryId, &WorkingDirectory)>
The entries that can be used for processing. The returned
entries are sorted by WorkingDirectoryId
pub fn active_entries_mut( &mut self, ) -> impl Iterator<Item = (WorkingDirectoryId, &mut WorkingDirectory)>
Sourcepub fn active_len(&self) -> usize
pub fn active_len(&self) -> usize
The number of entries that are not of Status::Error
Sourcepub fn process_in_working_directory<'pool, T>(
&'pool mut self,
working_directory_id: WorkingDirectoryId,
timestamp: &DateTimeWithOffset,
action: impl FnOnce(WorkingDirectoryWithPoolMut<'_>) -> Result<T>,
benchmarking_job_parameters: Option<&BenchmarkingJobParameters>,
context: &str,
have_other_jobs_for_same_commit: Option<&dyn Fn() -> bool>,
) -> Result<(T, WorkingDirectoryCleanupToken)>
pub fn process_in_working_directory<'pool, T>( &'pool mut self, working_directory_id: WorkingDirectoryId, timestamp: &DateTimeWithOffset, action: impl FnOnce(WorkingDirectoryWithPoolMut<'_>) -> Result<T>, benchmarking_job_parameters: Option<&BenchmarkingJobParameters>, context: &str, have_other_jobs_for_same_commit: Option<&dyn Fn() -> bool>, ) -> Result<(T, WorkingDirectoryCleanupToken)>
Runs the given action on the requested working directory with
the pool lock; the lock allows to use working directory
actions that require the lock, but it’s important to release
the lock as soon as possible via into_inner() (giving the
bare working directory, which can still be used for methods
that don’t require the lock), so that e.g. evobench wd
actions don’t block for the whole duration of an action
(i.e. a whole benchmarking run)! If the action returns with
an error, stores it as metadata with the directory and
changes the working directory to status Error. Returns an
error if a working directory with the given id doesn’t
exist. The returned WorkingDirectoryCleanupToken must be
passed to working_directory_cleanup. NOTE: is getting the
lock internally (multiple times for short durations, but also
passes the lock to action as mentioned above).
Sourcepub fn working_directory_cleanup(
&mut self,
cleanup: WorkingDirectoryCleanupToken,
) -> Result<()>
pub fn working_directory_cleanup( &mut self, cleanup: WorkingDirectoryCleanupToken, ) -> Result<()>
Possibly calls delete_working_directory, depending on what
the token says. NOTE: takes the lock internally, only when
needed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WorkingDirectoryPool
impl RefUnwindSafe for WorkingDirectoryPool
impl Send for WorkingDirectoryPool
impl Sync for WorkingDirectoryPool
impl Unpin for WorkingDirectoryPool
impl UnwindSafe for WorkingDirectoryPool
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
Source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
Source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);