pub struct DefaultState { /* private fields */ }Implementations§
Source§impl DefaultState
Auto-generated by derive_getters::Getters.
impl DefaultState
Auto-generated by derive_getters::Getters.
Sourcepub fn uninitialized_usages(&self) -> &BTreeSet<Either<Variable, List>>
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
Sourcepub fn initialized_data(&self) -> &BTreeSet<Either<Variable, List>>
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
Sourcepub fn variables(&self) -> &HashMap<Variable, SValue>
pub fn variables(&self) -> &HashMap<Variable, SValue>
Get field variables from instance of DefaultState.
Sourcepub fn answer_index(&self) -> &Option<usize>
pub fn answer_index(&self) -> &Option<usize>
Get field answer_index from instance of DefaultState.
Source§impl DefaultState
impl DefaultState
pub fn new() -> Self
pub fn from_doc(doc: &ProjectDoc, max_list_length: i64) -> Self
pub fn add_data_from_doc( &mut self, doc: &ProjectDoc, max_length: i64, ) -> &mut Self
pub fn add_variables_from_doc(&mut self, doc: &ProjectDoc) -> &mut Self
pub fn add_lists_from_doc( &mut self, doc: &ProjectDoc, max_length: i64, ) -> &mut Self
pub fn output_lines(&self) -> impl DoubleEndedIterator<Item = &SValue>
pub fn output_actions( &self, ) -> impl DoubleEndedIterator<Item = (&OutputKind, &SValue)>
pub fn used_randoms(&self) -> impl DoubleEndedIterator<Item = &SNumber>
pub fn set_randoms(&mut self, rng: Option<StdRng>) -> &mut Self
pub fn set_predefined_randoms( &mut self, predefined: ARc<[SNumber]>, ) -> &mut Self
pub fn set_answers(&mut self, answers: Vec<ARc<str>>) -> &mut Self
pub fn variables_mut(&mut self) -> &mut HashMap<Variable, SValue>
pub fn lists_mut(&mut self) -> &mut HashMap<List, SList>
Trait Implementations§
Source§impl Debug for DefaultState
impl Debug for DefaultState
Source§impl Default for DefaultState
impl Default for DefaultState
Source§fn default() -> DefaultState
fn default() -> DefaultState
Returns the “default value” for a type. Read more
Source§impl PartialEq for DefaultState
impl PartialEq for DefaultState
Source§impl State for DefaultState
impl State for DefaultState
type Error = DefaultStateError
fn ask_question(&mut self, question: SValue) -> Result<(), Self::Error>
fn last_answer(&mut self) -> Result<&str, Self::Error>
fn request_int_random( &mut self, range: RangeInclusive<i64>, ) -> Result<i64, Self::Error>
fn request_float_random( &mut self, range: RangeInclusive<f64>, ) -> Result<f64, Self::Error>
fn write_output(&mut self, output_kind: OutputKind, message: SValue)
fn wait_for_secs(&mut self, secs: SNumber) -> Result<(), Self::Error>
fn data_set_variable( &mut self, var_id: &Variable, value: SValue, ) -> Result<(), Self::Error>
fn data_read_variable( &mut self, var_id: &Variable, ) -> Result<&SValue, Self::Error>
fn data_insert_at_list( &mut self, list_id: &List, one_based_index: &SValue, item: SValue, ) -> Result<(), Self::Error>
fn data_replace_list_at( &mut self, list_id: &List, one_based_index: &SValue, item: SValue, ) -> Result<(), Self::Error>
fn data_append_to_list( &mut self, list_id: &List, item: SValue, ) -> Result<(), Self::Error>
fn data_list_contains_item( &mut self, list_id: &List, item: &SValue, ) -> Result<bool, Self::Error>
fn data_delete_of_list( &mut self, list_id: &List, one_based_index: &SValue, ) -> Result<(), Self::Error>
fn data_delete_all_of_list(&mut self, list_id: &List) -> Result<(), Self::Error>
fn data_read_textual_list_repr( &mut self, list_id: &List, ) -> Result<SValue, Self::Error>
fn data_item_num_of_list( &mut self, list_id: &List, item: &SValue, ) -> Result<i64, Self::Error>
fn data_item_of_list( &mut self, list_id: &List, one_based_index: &SValue, ) -> Result<SValue, Self::Error>
fn data_length_of_list(&mut self, list_id: &List) -> Result<i64, Self::Error>
fn set_statement_as_context(&mut self, _id: &Id) -> Result<(), Self::Error>
fn request_random( &mut self, range: RangeInclusive<SNumber>, ) -> Result<SNumber, Self::Error>
fn data_change_variable_by( &mut self, var_id: &Variable, by: SValue, ) -> Result<(), Self::Error>
fn notice_event_block_executed( &mut self, _event: &EventBlockKind, _block: &ARc<BlockWrapper>, ) -> Result<(), Self::Error>
fn notice_proc_def_block_executed( &mut self, _def: &ProceduresDefinition, _block: &ARc<BlockWrapper>, ) -> Result<(), Self::Error>
fn notice_proc_proto_block_executed( &mut self, _proto: &ProceduresPrototype, _block: &ARc<BlockWrapper>, ) -> Result<(), Self::Error>
impl StructuralPartialEq for DefaultState
Auto Trait Implementations§
impl !Send for DefaultState
impl !Sync for DefaultState
impl Freeze for DefaultState
impl RefUnwindSafe for DefaultState
impl Unpin for DefaultState
impl UnsafeUnpin for DefaultState
impl UnwindSafe for DefaultState
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
Mutably borrows from an owned value. Read more
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> ⓘ
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 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> ⓘ
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