Skip to main content

DefaultState

Struct DefaultState 

Source
pub struct DefaultState { /* private fields */ }

Implementations§

Source§

impl DefaultState

Auto-generated by derive_getters::Getters.

Source

pub fn uninitialized_usages(&self) -> &BTreeSet<Either<Variable, List>>

All data (variable/list) identifiers which were used before initialized

  • variables are initialized by set operation
  • lists are initialized by deleting all elements with clear block
Source

pub fn initialized_data(&self) -> &BTreeSet<Either<Variable, List>>

All data (variable/list) identifiers which were used to initialize the corresponding data.

  • variables are initialized by set operation
  • lists are initialized by deleting all elements with clear block
Source

pub fn variables(&self) -> &HashMap<Variable, SValue>

Get field variables from instance of DefaultState.

Source

pub fn lists(&self) -> &HashMap<List, SList>

Get field lists from instance of DefaultState.

Source

pub fn actions(&self) -> &Vec<Action>

Get field actions from instance of DefaultState.

Source

pub fn answer_index(&self) -> &Option<usize>

Get field answer_index from instance of DefaultState.

Source

pub fn answer_inputs(&self) -> &Vec<ARc<str>> ⓘ

Get field answer_inputs from instance of DefaultState.

Source

pub fn randoms(&self) -> &Option<StdRng>

Get field randoms from instance of DefaultState.

Source

pub fn predefined_randoms(&self) -> &Option<(ARc<[SNumber]>, usize)>

Get field predefined_randoms from instance of DefaultState.

Source§

impl DefaultState

Source

pub fn new() -> Self

Source

pub fn from_doc(doc: &ProjectDoc, max_list_length: i64) -> Self

Source

pub fn add_data_from_doc( &mut self, doc: &ProjectDoc, max_length: i64, ) -> &mut Self

Source

pub fn add_variables_from_doc(&mut self, doc: &ProjectDoc) -> &mut Self

Source

pub fn add_lists_from_doc( &mut self, doc: &ProjectDoc, max_length: i64, ) -> &mut Self

Source

pub fn output_lines(&self) -> impl DoubleEndedIterator<Item = &SValue>

Source

pub fn output_actions( &self, ) -> impl DoubleEndedIterator<Item = (&OutputKind, &SValue)>

Source

pub fn used_randoms(&self) -> impl DoubleEndedIterator<Item = &SNumber>

Source

pub fn set_randoms(&mut self, rng: Option<StdRng>) -> &mut Self

Source

pub fn set_predefined_randoms( &mut self, predefined: ARc<[SNumber]>, ) -> &mut Self

Source

pub fn set_answers(&mut self, answers: Vec<ARc<str>>) -> &mut Self

Source

pub fn variables_mut(&mut self) -> &mut HashMap<Variable, SValue>

Source

pub fn lists_mut(&mut self) -> &mut HashMap<List, SList>

Trait Implementations§

Source§

impl Debug for DefaultState

Source§

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

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

impl Default for DefaultState

Source§

fn default() -> DefaultState

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

impl PartialEq for DefaultState

Source§

fn eq(&self, other: &DefaultState) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl State for DefaultState

Source§

type Error = DefaultStateError

Source§

fn ask_question(&mut self, question: SValue) -> Result<(), Self::Error>

Source§

fn last_answer(&mut self) -> Result<&str, Self::Error>

Source§

fn request_int_random( &mut self, range: RangeInclusive<i64>, ) -> Result<i64, Self::Error>

Source§

fn request_float_random( &mut self, range: RangeInclusive<f64>, ) -> Result<f64, Self::Error>

Source§

fn write_output(&mut self, output_kind: OutputKind, message: SValue)

Source§

fn wait_for_secs(&mut self, secs: SNumber) -> Result<(), Self::Error>

Source§

fn data_set_variable( &mut self, var_id: &Variable, value: SValue, ) -> Result<(), Self::Error>

Source§

fn data_read_variable( &mut self, var_id: &Variable, ) -> Result<&SValue, Self::Error>

Source§

fn data_insert_at_list( &mut self, list_id: &List, one_based_index: &SValue, item: SValue, ) -> Result<(), Self::Error>

Source§

fn data_replace_list_at( &mut self, list_id: &List, one_based_index: &SValue, item: SValue, ) -> Result<(), Self::Error>

Source§

fn data_append_to_list( &mut self, list_id: &List, item: SValue, ) -> Result<(), Self::Error>

Source§

fn data_list_contains_item( &mut self, list_id: &List, item: &SValue, ) -> Result<bool, Self::Error>

Source§

fn data_delete_of_list( &mut self, list_id: &List, one_based_index: &SValue, ) -> Result<(), Self::Error>

Source§

fn data_delete_all_of_list(&mut self, list_id: &List) -> Result<(), Self::Error>

Source§

fn data_read_textual_list_repr( &mut self, list_id: &List, ) -> Result<SValue, Self::Error>

Source§

fn data_item_num_of_list( &mut self, list_id: &List, item: &SValue, ) -> Result<i64, Self::Error>

Source§

fn data_item_of_list( &mut self, list_id: &List, one_based_index: &SValue, ) -> Result<SValue, Self::Error>

Source§

fn data_length_of_list(&mut self, list_id: &List) -> Result<i64, Self::Error>

Source§

fn set_statement_as_context(&mut self, _id: &Id) -> Result<(), Self::Error>

Source§

fn request_random( &mut self, range: RangeInclusive<SNumber>, ) -> Result<SNumber, Self::Error>

Source§

fn data_change_variable_by( &mut self, var_id: &Variable, by: SValue, ) -> Result<(), Self::Error>

Source§

fn notice_event_block_executed( &mut self, _event: &EventBlockKind, _block: &ARc<BlockWrapper>, ) -> Result<(), Self::Error>

Source§

fn notice_proc_def_block_executed( &mut self, _def: &ProceduresDefinition, _block: &ARc<BlockWrapper>, ) -> Result<(), Self::Error>

Source§

fn notice_proc_proto_block_executed( &mut self, _proto: &ProceduresPrototype, _block: &ARc<BlockWrapper>, ) -> Result<(), Self::Error>

Source§

impl StructuralPartialEq for DefaultState

Auto Trait Implementations§

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
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.