pub struct CourseView {
pub course: Course,
pub live: CourseState,
pub staged: CourseState,
pub changeset: Option<AgentChangeset>,
pub staged_entities: BTreeMap<EntityKey, AgentChangesetEntity>,
}Expand description
The published course and the user’s staged view of it.
Fields§
§course: Course§live: CourseState§staged: CourseState§changeset: Option<AgentChangeset>§staged_entities: BTreeMap<EntityKey, AgentChangesetEntity>Implementations§
Source§impl CourseView
impl CourseView
Sourcepub fn staged_row(&self, key: EntityKey) -> Option<&AgentChangesetEntity>
pub fn staged_row(&self, key: EntityKey) -> Option<&AgentChangesetEntity>
The changeset’s row for the entity; None if it isn’t staged.
Sourcepub fn exercise_page_id(&self, exercise_id: Uuid) -> Option<Uuid>
pub fn exercise_page_id(&self, exercise_id: Uuid) -> Option<Uuid>
The page holding the exercise as the user sees it, else the one its live record names.
Sourcepub fn staged_page_snapshot(
&self,
page_id: Uuid,
) -> Option<Option<&PageSnapshot>>
pub fn staged_page_snapshot( &self, page_id: Uuid, ) -> Option<Option<&PageSnapshot>>
The page’s full staged snapshot: Some(None) when the changeset deletes it, None when
the changeset doesn’t have it.
Sourcepub async fn current_page_snapshots(
&self,
conn: &mut PgConnection,
page_ids: &[Uuid],
) -> ModelResult<HashMap<Uuid, PageSnapshot>>
pub async fn current_page_snapshots( &self, conn: &mut PgConnection, page_ids: &[Uuid], ) -> ModelResult<HashMap<Uuid, PageSnapshot>>
The pages’ full snapshots as the user sees them, exercises included, by id; the pages that don’t exist for the user are left out.
Sourcepub async fn load_exercises(
&mut self,
conn: &mut PgConnection,
) -> ModelResult<()>
pub async fn load_exercises( &mut self, conn: &mut PgConnection, ) -> ModelResult<()>
Loads the exercise records of both states, unless they are loaded already. The view must hold every part of the course.
Sourcepub async fn load_exercises_on_pages(
&mut self,
conn: &mut PgConnection,
page_ids: &[Uuid],
) -> ModelResult<()>
pub async fn load_exercises_on_pages( &mut self, conn: &mut PgConnection, page_ids: &[Uuid], ) -> ModelResult<()>
Loads into both states the records of the exercises on page_ids, staged or published,
and maybe others; does nothing if records are already loaded. The view must hold every
part of the course.
Sourceasync fn load_exercise_records(
&mut self,
conn: &mut PgConnection,
page_ids: &[Uuid],
) -> ModelResult<()>
async fn load_exercise_records( &mut self, conn: &mut PgConnection, page_ids: &[Uuid], ) -> ModelResult<()>
Loads the records of the live pages page_ids into both states, then lays the staged
pages’ over the staged state.
Trait Implementations§
Source§impl Clone for CourseView
impl Clone for CourseView
Source§fn clone(&self) -> CourseView
fn clone(&self) -> CourseView
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CourseView
impl RefUnwindSafe for CourseView
impl Send for CourseView
impl Sync for CourseView
impl Unpin for CourseView
impl UnsafeUnpin for CourseView
impl UnwindSafe for CourseView
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].