Struct State

Source
pub struct State { /* private fields */ }
Expand description

The data backing a mock Lava instance

This is a persian_rug::Context containing all of the different data types that make up the database of a Lava instance.

Implementations§

Source§

impl State

Source

pub fn new() -> Self

Create a new empty State

Source

pub fn make_device_type_generator() -> impl GeneratorWithPersianRug<State, Output = Proxy<DeviceType<State>>>

A DeviceType GeneratorWithPersianRug that uses dependencies already in the State.

This generator is equivalent to the default, except that it draws Alias, Architecture, BitWidth, Core and ProcessorFamily instances from those already in the containing State at the point of generation.

Source

pub fn make_user_generator() -> impl GeneratorWithPersianRug<State, Output = Proxy<User<State>>>

A User GeneratorWithPersianRug that uses dependencies already in the State.

This generator is equivalent to the default, except that it draws Group instances from those already in the containing State at the point of generation.

Source

pub fn make_device_generator() -> impl GeneratorWithPersianRug<State, Output = Proxy<Device<State>>>

A Device GeneratorWithPersianRug that uses dependencies already in the State.

This generator is equivalent to the default, except that it draws DeviceType, User, Group, Tag and Worker instances from those already in the containing State at the point of generation.

Source

pub fn make_job_generator() -> impl GeneratorWithPersianRug<State, Output = Proxy<Job<State>>>

A Job GeneratorWithPersianRug that uses dependencies already in the State.

This generator is equivalent to the default, except that it draws User, Group, DeviceType, Tag and Device instances from those already in the containing State at the point of generation.

Source

pub fn new_populated(pop: PopulationParams) -> Self

Create a new State with some initial data.

Here, pop is a PopulationParams which gives the initial number of each type of object. The object generators are customised to draw their references from the other objects in the state.

You can obtain new instances of themodified generators from make_device_generator, make_device_type_generator, make_job_generator and make_user_generator if you need to create more objects in a similar fashion.

Note that because tests are per-job objects, the counts in PopulationParams for TestCase, TestSet and TestSuite are used to make custom objects for each job. The tests are not provided automatically when jobs are generated by the underlying GeneratorWithPersianRug provided by make_job_generator.

Trait Implementations§

Source§

impl Clone for State

Source§

fn clone(&self) -> State

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Context for State

Source§

fn add<T>(&mut self, what: T) -> Proxy<T>
where State: Owner<T>, T: Contextual<Context = Self>,

Insert the given value, returning a Proxy for it.
Source§

fn get<T>(&self, what: &Proxy<T>) -> &T
where State: Owner<T>, T: Contextual<Context = Self>,

Retrieve a reference to a value from a Proxy.
Source§

fn get_mut<T>(&mut self, what: &Proxy<T>) -> &mut T
where State: Owner<T>, T: Contextual<Context = Self>,

Retrieve a mutable reference to a value from a Proxy.
Source§

fn get_iter<T>(&self) -> TableIterator<'_, T>
where State: Owner<T>, T: Contextual<Context = Self>,

Iterate over the values currently stored.
Source§

fn get_iter_mut<T>(&mut self) -> TableMutIterator<'_, T>
where State: Owner<T>, T: Contextual<Context = Self>,

Mutably iterate over the values currently stored.
Source§

fn get_proxy_iter<T>(&self) -> TableProxyIterator<'_, T>
where State: Owner<T>, T: Contextual<Context = Self>,

Iterate over (owned) proxies for the values currently stored.
Source§

impl Debug for State

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for State

Source§

fn default() -> State

Returns the “default value” for a type. Read more
Source§

impl Owner<Alias<State>> for State

Source§

fn add(&mut self, what: Alias<State>) -> Proxy<Alias<State>>

Insert the given value, obtaining a Proxy for it.
Source§

fn get(&self, what: &Proxy<Alias<State>>) -> &Alias<State>

Get a shared reference to a value from a Proxy for it.
Source§

fn get_mut(&mut self, what: &Proxy<Alias<State>>) -> &mut Alias<State>

Get an exclusive reference to a value from a Proxy for it.
Source§

fn get_iter(&self) -> TableIterator<'_, Alias<State>>

Iterate over shared references to the stored values.
Source§

fn get_iter_mut(&mut self) -> TableMutIterator<'_, Alias<State>>

Iterate over exclusive references to the stored values.
Source§

fn get_proxy_iter(&self) -> TableProxyIterator<'_, Alias<State>>

Iterate over shared references to Proxy objects for the stored values.
Source§

impl Owner<Architecture<State>> for State

Source§

fn add(&mut self, what: Architecture<State>) -> Proxy<Architecture<State>>

Insert the given value, obtaining a Proxy for it.
Source§

fn get(&self, what: &Proxy<Architecture<State>>) -> &Architecture<State>

Get a shared reference to a value from a Proxy for it.
Source§

fn get_mut( &mut self, what: &Proxy<Architecture<State>>, ) -> &mut Architecture<State>

Get an exclusive reference to a value from a Proxy for it.
Source§

fn get_iter(&self) -> TableIterator<'_, Architecture<State>>

Iterate over shared references to the stored values.
Source§

fn get_iter_mut(&mut self) -> TableMutIterator<'_, Architecture<State>>

Iterate over exclusive references to the stored values.
Source§

fn get_proxy_iter(&self) -> TableProxyIterator<'_, Architecture<State>>

Iterate over shared references to Proxy objects for the stored values.
Source§

impl Owner<BitWidth<State>> for State

Source§

fn add(&mut self, what: BitWidth<State>) -> Proxy<BitWidth<State>>

Insert the given value, obtaining a Proxy for it.
Source§

fn get(&self, what: &Proxy<BitWidth<State>>) -> &BitWidth<State>

Get a shared reference to a value from a Proxy for it.
Source§

fn get_mut(&mut self, what: &Proxy<BitWidth<State>>) -> &mut BitWidth<State>

Get an exclusive reference to a value from a Proxy for it.
Source§

fn get_iter(&self) -> TableIterator<'_, BitWidth<State>>

Iterate over shared references to the stored values.
Source§

fn get_iter_mut(&mut self) -> TableMutIterator<'_, BitWidth<State>>

Iterate over exclusive references to the stored values.
Source§

fn get_proxy_iter(&self) -> TableProxyIterator<'_, BitWidth<State>>

Iterate over shared references to Proxy objects for the stored values.
Source§

impl Owner<Core<State>> for State

Source§

fn add(&mut self, what: Core<State>) -> Proxy<Core<State>>

Insert the given value, obtaining a Proxy for it.
Source§

fn get(&self, what: &Proxy<Core<State>>) -> &Core<State>

Get a shared reference to a value from a Proxy for it.
Source§

fn get_mut(&mut self, what: &Proxy<Core<State>>) -> &mut Core<State>

Get an exclusive reference to a value from a Proxy for it.
Source§

fn get_iter(&self) -> TableIterator<'_, Core<State>>

Iterate over shared references to the stored values.
Source§

fn get_iter_mut(&mut self) -> TableMutIterator<'_, Core<State>>

Iterate over exclusive references to the stored values.
Source§

fn get_proxy_iter(&self) -> TableProxyIterator<'_, Core<State>>

Iterate over shared references to Proxy objects for the stored values.
Source§

impl Owner<Device<State>> for State

Source§

fn add(&mut self, what: Device<State>) -> Proxy<Device<State>>

Insert the given value, obtaining a Proxy for it.
Source§

fn get(&self, what: &Proxy<Device<State>>) -> &Device<State>

Get a shared reference to a value from a Proxy for it.
Source§

fn get_mut(&mut self, what: &Proxy<Device<State>>) -> &mut Device<State>

Get an exclusive reference to a value from a Proxy for it.
Source§

fn get_iter(&self) -> TableIterator<'_, Device<State>>

Iterate over shared references to the stored values.
Source§

fn get_iter_mut(&mut self) -> TableMutIterator<'_, Device<State>>

Iterate over exclusive references to the stored values.
Source§

fn get_proxy_iter(&self) -> TableProxyIterator<'_, Device<State>>

Iterate over shared references to Proxy objects for the stored values.
Source§

impl Owner<DeviceType<State>> for State

Source§

fn add(&mut self, what: DeviceType<State>) -> Proxy<DeviceType<State>>

Insert the given value, obtaining a Proxy for it.
Source§

fn get(&self, what: &Proxy<DeviceType<State>>) -> &DeviceType<State>

Get a shared reference to a value from a Proxy for it.
Source§

fn get_mut(&mut self, what: &Proxy<DeviceType<State>>) -> &mut DeviceType<State>

Get an exclusive reference to a value from a Proxy for it.
Source§

fn get_iter(&self) -> TableIterator<'_, DeviceType<State>>

Iterate over shared references to the stored values.
Source§

fn get_iter_mut(&mut self) -> TableMutIterator<'_, DeviceType<State>>

Iterate over exclusive references to the stored values.
Source§

fn get_proxy_iter(&self) -> TableProxyIterator<'_, DeviceType<State>>

Iterate over shared references to Proxy objects for the stored values.
Source§

impl Owner<Group<State>> for State

Source§

fn add(&mut self, what: Group<State>) -> Proxy<Group<State>>

Insert the given value, obtaining a Proxy for it.
Source§

fn get(&self, what: &Proxy<Group<State>>) -> &Group<State>

Get a shared reference to a value from a Proxy for it.
Source§

fn get_mut(&mut self, what: &Proxy<Group<State>>) -> &mut Group<State>

Get an exclusive reference to a value from a Proxy for it.
Source§

fn get_iter(&self) -> TableIterator<'_, Group<State>>

Iterate over shared references to the stored values.
Source§

fn get_iter_mut(&mut self) -> TableMutIterator<'_, Group<State>>

Iterate over exclusive references to the stored values.
Source§

fn get_proxy_iter(&self) -> TableProxyIterator<'_, Group<State>>

Iterate over shared references to Proxy objects for the stored values.
Source§

impl Owner<Job<State>> for State

Source§

fn add(&mut self, what: Job<State>) -> Proxy<Job<State>>

Insert the given value, obtaining a Proxy for it.
Source§

fn get(&self, what: &Proxy<Job<State>>) -> &Job<State>

Get a shared reference to a value from a Proxy for it.
Source§

fn get_mut(&mut self, what: &Proxy<Job<State>>) -> &mut Job<State>

Get an exclusive reference to a value from a Proxy for it.
Source§

fn get_iter(&self) -> TableIterator<'_, Job<State>>

Iterate over shared references to the stored values.
Source§

fn get_iter_mut(&mut self) -> TableMutIterator<'_, Job<State>>

Iterate over exclusive references to the stored values.
Source§

fn get_proxy_iter(&self) -> TableProxyIterator<'_, Job<State>>

Iterate over shared references to Proxy objects for the stored values.
Source§

impl Owner<ProcessorFamily<State>> for State

Source§

fn add(&mut self, what: ProcessorFamily<State>) -> Proxy<ProcessorFamily<State>>

Insert the given value, obtaining a Proxy for it.
Source§

fn get(&self, what: &Proxy<ProcessorFamily<State>>) -> &ProcessorFamily<State>

Get a shared reference to a value from a Proxy for it.
Source§

fn get_mut( &mut self, what: &Proxy<ProcessorFamily<State>>, ) -> &mut ProcessorFamily<State>

Get an exclusive reference to a value from a Proxy for it.
Source§

fn get_iter(&self) -> TableIterator<'_, ProcessorFamily<State>>

Iterate over shared references to the stored values.
Source§

fn get_iter_mut(&mut self) -> TableMutIterator<'_, ProcessorFamily<State>>

Iterate over exclusive references to the stored values.
Source§

fn get_proxy_iter(&self) -> TableProxyIterator<'_, ProcessorFamily<State>>

Iterate over shared references to Proxy objects for the stored values.
Source§

impl Owner<Tag<State>> for State

Source§

fn add(&mut self, what: Tag<State>) -> Proxy<Tag<State>>

Insert the given value, obtaining a Proxy for it.
Source§

fn get(&self, what: &Proxy<Tag<State>>) -> &Tag<State>

Get a shared reference to a value from a Proxy for it.
Source§

fn get_mut(&mut self, what: &Proxy<Tag<State>>) -> &mut Tag<State>

Get an exclusive reference to a value from a Proxy for it.
Source§

fn get_iter(&self) -> TableIterator<'_, Tag<State>>

Iterate over shared references to the stored values.
Source§

fn get_iter_mut(&mut self) -> TableMutIterator<'_, Tag<State>>

Iterate over exclusive references to the stored values.
Source§

fn get_proxy_iter(&self) -> TableProxyIterator<'_, Tag<State>>

Iterate over shared references to Proxy objects for the stored values.
Source§

impl Owner<TestCase<State>> for State

Source§

fn add(&mut self, what: TestCase<State>) -> Proxy<TestCase<State>>

Insert the given value, obtaining a Proxy for it.
Source§

fn get(&self, what: &Proxy<TestCase<State>>) -> &TestCase<State>

Get a shared reference to a value from a Proxy for it.
Source§

fn get_mut(&mut self, what: &Proxy<TestCase<State>>) -> &mut TestCase<State>

Get an exclusive reference to a value from a Proxy for it.
Source§

fn get_iter(&self) -> TableIterator<'_, TestCase<State>>

Iterate over shared references to the stored values.
Source§

fn get_iter_mut(&mut self) -> TableMutIterator<'_, TestCase<State>>

Iterate over exclusive references to the stored values.
Source§

fn get_proxy_iter(&self) -> TableProxyIterator<'_, TestCase<State>>

Iterate over shared references to Proxy objects for the stored values.
Source§

impl Owner<TestSet<State>> for State

Source§

fn add(&mut self, what: TestSet<State>) -> Proxy<TestSet<State>>

Insert the given value, obtaining a Proxy for it.
Source§

fn get(&self, what: &Proxy<TestSet<State>>) -> &TestSet<State>

Get a shared reference to a value from a Proxy for it.
Source§

fn get_mut(&mut self, what: &Proxy<TestSet<State>>) -> &mut TestSet<State>

Get an exclusive reference to a value from a Proxy for it.
Source§

fn get_iter(&self) -> TableIterator<'_, TestSet<State>>

Iterate over shared references to the stored values.
Source§

fn get_iter_mut(&mut self) -> TableMutIterator<'_, TestSet<State>>

Iterate over exclusive references to the stored values.
Source§

fn get_proxy_iter(&self) -> TableProxyIterator<'_, TestSet<State>>

Iterate over shared references to Proxy objects for the stored values.
Source§

impl Owner<TestSuite<State>> for State

Source§

fn add(&mut self, what: TestSuite<State>) -> Proxy<TestSuite<State>>

Insert the given value, obtaining a Proxy for it.
Source§

fn get(&self, what: &Proxy<TestSuite<State>>) -> &TestSuite<State>

Get a shared reference to a value from a Proxy for it.
Source§

fn get_mut(&mut self, what: &Proxy<TestSuite<State>>) -> &mut TestSuite<State>

Get an exclusive reference to a value from a Proxy for it.
Source§

fn get_iter(&self) -> TableIterator<'_, TestSuite<State>>

Iterate over shared references to the stored values.
Source§

fn get_iter_mut(&mut self) -> TableMutIterator<'_, TestSuite<State>>

Iterate over exclusive references to the stored values.
Source§

fn get_proxy_iter(&self) -> TableProxyIterator<'_, TestSuite<State>>

Iterate over shared references to Proxy objects for the stored values.
Source§

impl Owner<User<State>> for State

Source§

fn add(&mut self, what: User<State>) -> Proxy<User<State>>

Insert the given value, obtaining a Proxy for it.
Source§

fn get(&self, what: &Proxy<User<State>>) -> &User<State>

Get a shared reference to a value from a Proxy for it.
Source§

fn get_mut(&mut self, what: &Proxy<User<State>>) -> &mut User<State>

Get an exclusive reference to a value from a Proxy for it.
Source§

fn get_iter(&self) -> TableIterator<'_, User<State>>

Iterate over shared references to the stored values.
Source§

fn get_iter_mut(&mut self) -> TableMutIterator<'_, User<State>>

Iterate over exclusive references to the stored values.
Source§

fn get_proxy_iter(&self) -> TableProxyIterator<'_, User<State>>

Iterate over shared references to Proxy objects for the stored values.
Source§

impl Owner<Worker<State>> for State

Source§

fn add(&mut self, what: Worker<State>) -> Proxy<Worker<State>>

Insert the given value, obtaining a Proxy for it.
Source§

fn get(&self, what: &Proxy<Worker<State>>) -> &Worker<State>

Get a shared reference to a value from a Proxy for it.
Source§

fn get_mut(&mut self, what: &Proxy<Worker<State>>) -> &mut Worker<State>

Get an exclusive reference to a value from a Proxy for it.
Source§

fn get_iter(&self) -> TableIterator<'_, Worker<State>>

Iterate over shared references to the stored values.
Source§

fn get_iter_mut(&mut self) -> TableMutIterator<'_, Worker<State>>

Iterate over exclusive references to the stored values.
Source§

fn get_proxy_iter(&self) -> TableProxyIterator<'_, Worker<State>>

Iterate over shared references to Proxy objects for the stored values.

Auto Trait Implementations§

§

impl Freeze for State

§

impl RefUnwindSafe for State

§

impl Send for State

§

impl Sync for State

§

impl Unpin for State

§

impl UnwindSafe for State

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,