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 Freeze for ExerciseWithUserState
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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