Skip to main content

Record

Struct Record 

Source
pub struct Record {
Show 13 fields pub id: String, pub plan: Option<String>, pub wish: String, pub asked: String, pub started: Timestamp, pub ended: Timestamp, pub outcome: Outcome, pub cost: f64, pub cost_unmeasured: bool, pub steps: Vec<StepRecord>, pub decisions: Vec<Decision>, pub versions: Vec<Version>, pub journal: Vec<Entry>,
}
Expand description

One run of a plan.

Fields§

§id: String

What names the run: when it started and the plan’s name. Its file in .vpf/runs is {id}.json.

§plan: Option<String>

The plan’s name, when it has one.

§wish: String

The plan’s wish.

§asked: String

What the run was started with.

§started: Timestamp

When it started.

§ended: Timestamp

When it ended, or last stopped to wait.

§outcome: Outcome

How it ended, or what it waits for.

§cost: f64

What the agents said it cost.

§cost_unmeasured: bool

Whether some agent did not say what it cost.

§steps: Vec<StepRecord>

Every step of the plan, in the order written.

§decisions: Vec<Decision>

What the person decided.

§versions: Vec<Version>

Each version of the plan the run followed, the first first.

§journal: Vec<Entry>

Everything the run was given from outside it, by agents, commands, people and the clock, so that it can go on from where it stands without asking any of it again.

Implementations§

Source§

impl Record

Source

pub fn to_json(&self) -> Value

The record as JSON.

Source

pub fn load(file: &Path) -> Result<Self, String>

Reads a record kept in a file.

§Errors

When the file cannot be read, or does not hold a record.

Source

pub fn file(&self, folder: &Path) -> PathBuf

Where the record is kept in the folder.

Source

pub fn keep(&self, folder: &Path) -> Result<PathBuf>

Writes the record in the folder’s .vpf/runs, in place of what it kept of the run before.

§Errors

When the file cannot be written.

Source

pub fn add_entries(&mut self, entries: impl IntoIterator<Item = Entry>)

Adds entries a Keeper was handed to the run’s journal, in order: an entry under a key the journal holds takes the place of the one there. A run that stopped in the middle is rebuilt this way from the record it began with, and goes on without asking any of them again.

Source

pub fn reply( &mut self, key: &str, reply: Reply, by: Option<&str>, ) -> Result<(), String>

Gives a waiting run the reply to what it waits for under key, from by when they say who they are. The run goes on with it when it is resumed.

§Errors

When the run does not wait for key, the reply does not fit what is asked, or the question is for named people and by is not one of them.

Source

pub fn change( &mut self, plan: &Plan, approved_by: &str, at: Timestamp, ) -> Result<(), String>

Takes a new version of the plan for a waiting run, approved by approved_by: the run goes on with it from where it stands when it is resumed.

§Errors

When the run does not wait, no one approved, the plan has problems, a step that ended is not in it as it was, or a step that started is not in it with the same id, by and do.

Trait Implementations§

Source§

impl Clone for Record

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Record

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Record

§

impl Freeze for Record

§

impl Move for Record

§

impl RefUnwindSafe for Record

§

impl Send for Record
where RawVecInner: Send, NodeRef<Owned, String, String, LeafOrInternal>: Send, BoxRaw<(String, String)>: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send,

§

impl Sync for Record
where RawVecInner: Sync, NodeRef<Owned, String, String, LeafOrInternal>: Sync, BoxRaw<(String, String)>: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync,

§

impl Unpin for Record
where *const u8 is !null: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin,

§

impl UnsafeUnpin for Record

§

impl UnwindSafe for Record

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.