pub struct CourseBuilder {Show 14 fields
pub name: String,
pub slug: String,
pub language_code: String,
pub can_add_chatbot: bool,
pub description: String,
pub default_instance_name: &'static [u8],
pub modules: Vec<ModuleBuilder>,
pub extra_roles: Vec<(Uuid, UserRole)>,
pub course_id: Option<Uuid>,
pub instances: Vec<CourseInstanceConfig>,
pub pages: Vec<PageConfig>,
pub glossary_entries: Vec<GlossaryEntry>,
pub certificate_config: Option<CertificateConfig>,
pub front_page_content: Option<Vec<GutenbergBlock>>,
}
Expand description
Builder for courses with modules, chapters, pages, and exercises.
Fields§
§name: String
§slug: String
§language_code: String
§can_add_chatbot: bool
§description: String
§default_instance_name: &'static [u8]
§modules: Vec<ModuleBuilder>
§extra_roles: Vec<(Uuid, UserRole)>
§course_id: Option<Uuid>
§instances: Vec<CourseInstanceConfig>
§pages: Vec<PageConfig>
§glossary_entries: Vec<GlossaryEntry>
§certificate_config: Option<CertificateConfig>
§front_page_content: Option<Vec<GutenbergBlock>>
Implementations§
Source§impl CourseBuilder
impl CourseBuilder
pub fn new(name: impl Into<String>, slug: impl Into<String>) -> Self
pub fn chatbot(self, v: bool) -> Self
pub fn desc(self, d: impl Into<String>) -> Self
pub fn language(self, lc: impl Into<String>) -> Self
pub fn module(self, m: ModuleBuilder) -> Self
pub fn modules<I: IntoIterator<Item = ModuleBuilder>>(self, it: I) -> Self
pub fn role(self, user_id: Uuid, role: UserRole) -> Self
pub fn course_id(self, id: Uuid) -> Self
pub fn instance(self, config: CourseInstanceConfig) -> Self
Sourcepub fn top_level_page(
self,
url: impl Into<String>,
title: impl Into<String>,
page_number: i32,
is_hidden: bool,
content: Option<Vec<GutenbergBlock>>,
) -> Self
pub fn top_level_page( self, url: impl Into<String>, title: impl Into<String>, page_number: i32, is_hidden: bool, content: Option<Vec<GutenbergBlock>>, ) -> Self
Add a top-level page to the course
pub fn glossary_entry( self, acronym: impl Into<String>, definition: impl Into<String>, ) -> Self
pub fn certificate_config( self, background_svg_path: impl Into<String>, certificate_id: Option<Uuid>, ) -> Self
Sourcepub fn front_page_content(self, content: Vec<GutenbergBlock>) -> Self
pub fn front_page_content(self, content: Vec<GutenbergBlock>) -> Self
Set custom content for the course front page. If not set, default content will be used.
Sourcepub async fn seed(
self,
cx: &mut SeedContext<'_>,
) -> Result<(Course, CourseInstance, CourseModule)>
pub async fn seed( self, cx: &mut SeedContext<'_>, ) -> Result<(Course, CourseInstance, CourseModule)>
Seeds the course and all nested content. Returns (course, default_instance, last_module)
.
Trait Implementations§
Source§impl Clone for CourseBuilder
impl Clone for CourseBuilder
Source§fn clone(&self) -> CourseBuilder
fn clone(&self) -> CourseBuilder
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for CourseBuilder
impl RefUnwindSafe for CourseBuilder
impl Send for CourseBuilder
impl Sync for CourseBuilder
impl Unpin for CourseBuilder
impl UnwindSafe for CourseBuilder
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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