pub struct Open { /* private fields */ }Expand description
A running QCode, as the other QCodes and the service see it: a shared lock on the lock file, held for as long as this value lives.
Any number of QCodes hold one at once. Taking it waits only while the service is stopping containers, so a QCode starting then waits for that instead of starting a container the service is about to stop.
Implementations§
Source§impl Open
impl Open
Sourcepub fn hold(places: Places) -> Result<Self>
pub fn hold(places: Places) -> Result<Self>
Takes the shared lock at places, making its folder first.
§Errors
When the folder or the file cannot be made or locked, and
io::ErrorKind::Unsupported on Windows.
Sourcepub fn close(
self,
on_close: &dyn Fn() -> OnClose,
engines: &mut Engines<'_>,
) -> Result<Option<Reaped>>
pub fn close( self, on_close: &dyn Fn() -> OnClose, engines: &mut Engines<'_>, ) -> Result<Option<Reaped>>
Closes this QCode: lets go of its lock and, when no other QCode holds one, does the
service’s work itself — stops the listed containers if on_close says to and empties
the list. Answers what came of it, or None when another QCode is still open or the
service is already at work.
The setting is asked for only once this is the last QCode, so a choice made in another QCode a moment ago counts. The exclusive lock is asked for without waiting and held for the stopping only: a QCode starting meanwhile waits for it.
§Errors
When the lock file cannot be opened, or what stays listed cannot be written.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Open
impl RefUnwindSafe for Open
impl Send for Open
impl Sync for Open
impl Unpin for Open
impl UnsafeUnpin for Open
impl UnwindSafe for Open
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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