pub struct Registry {
pub containers: Vec<Registered>,
}Expand description
The containers QCode started, in the order it first started them.
Fields§
§containers: Vec<Registered>Every container, each name once.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn file() -> Option<PathBuf>
pub fn file() -> Option<PathBuf>
Where the list of this user is kept: containers.toml in QCode’s data folder, or None
on a machine that names no home, where nothing is recorded and so nothing is stopped.
Sourcepub fn add(&mut self, name: &str, engine: EngineKind) -> bool
pub fn add(&mut self, name: &str, engine: EngineKind) -> bool
Adds name in engine, unless it is there already or is not one of QCode’s names.
Answers whether the list changed.
Sourcepub fn load(path: &Path) -> Loaded<Self>
pub fn load(path: &Path) -> Loaded<Self>
Reads the list at path.
A file that is not there is an empty list: nothing was started yet, or everything was stopped. A file that cannot be read is an empty list with a diagnostic that says why.
Sourcepub fn parse(file: &str, text: &str) -> Loaded<Self>
pub fn parse(file: &str, text: &str) -> Loaded<Self>
Reads a list from text, reporting problems against file.
An entry that is not one of QCode’s containers, or names no engine QCode drives, is left out with a diagnostic; a name listed twice is kept once.
Sourcepub fn save(&self, path: &Path) -> Result<()>
pub fn save(&self, path: &Path) -> Result<()>
Writes the list to path atomically, making its folder first when it is not there.
§Errors
Returns the I/O error when the folder or the file cannot be written.
Sourcepub fn record(
path: &Path,
name: &str,
engine: EngineKind,
) -> Result<Vec<Diagnostic>>
pub fn record( path: &Path, name: &str, engine: EngineKind, ) -> Result<Vec<Diagnostic>>
Notes in the list at path that QCode started the container name in engine, and
answers what was wrong with the file it found there.
The file is only written when the name is new, so the tab opened for the hundredth time costs a read and nothing more, and a watcher of the file is not woken for nothing. A file that was damaged is written again with what could be read of it and the new name: the container that just started would otherwise never be stopped, and the problems are answered so the person hears of them. A name that is not QCode’s is not written at all.
This reads and writes the disk, so it belongs on a background thread.
§Errors
Returns the I/O error when the file cannot be written.
Trait Implementations§
impl Eq for Registry
impl StructuralPartialEq for Registry
Auto Trait Implementations§
impl Freeze for Registry
impl RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
impl UnwindSafe for Registry
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> 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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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