pub struct ExerciseWithUserState {
exercise: Exercise,
user_exercise_state: UserExerciseState,
type_data: EwusCourseOrExam,
}
Expand description
Convenience struct that combines user state to the exercise.
Many operations require information about both the user state and the exercise. However, because
exercises can either belong to a course or an exam, and each course instance will have their
own UserExerciseState
, it can get difficult to track the proper context.
Fields§
§exercise: Exercise
§user_exercise_state: UserExerciseState
§type_data: EwusCourseOrExam
Implementations§
source§impl ExerciseWithUserState
impl ExerciseWithUserState
pub fn new( exercise: Exercise, user_exercise_state: UserExerciseState ) -> ModelResult<Self>
sourcepub fn user_exercise_state(&self) -> &UserExerciseState
pub fn user_exercise_state(&self) -> &UserExerciseState
Provides a reference to the inner UserExerciseState
.
pub fn exercise_context(&self) -> &EwusCourseOrExam
pub fn set_user_exercise_state( &mut self, user_exercise_state: UserExerciseState ) -> ModelResult<()>
pub fn is_exam_exercise(&self) -> bool
Auto Trait Implementations§
impl RefUnwindSafe for ExerciseWithUserState
impl Send for ExerciseWithUserState
impl Sync for ExerciseWithUserState
impl Unpin for ExerciseWithUserState
impl UnwindSafe for ExerciseWithUserState
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