shared::domain::module::body

Trait BodyExt

Source
pub trait BodyExt<Mode: ModeExt, Step: StepExt>:
    BodyConvert
    + TryFrom<Body>
    + Serialize
    + DeserializeOwned
    + Clone
    + Debug {
Show 17 methods // Required methods fn as_body(&self) -> Body; fn is_complete(&self) -> bool; fn kind() -> ModuleKind; fn new_with_mode_and_theme(mode: Mode, theme_id: ThemeId) -> Self; fn mode(&self) -> Option<Mode>; fn requires_choose_mode(&self) -> bool; fn get_theme(&self) -> Option<ThemeId>; fn set_theme(&mut self, theme_id: ThemeId); fn set_editor_state_step(&mut self, step: Step); fn set_editor_state_steps_completed( &mut self, steps_completed: HashSet<Step>, ); fn get_editor_state_step(&self) -> Option<Step>; fn get_editor_state_steps_completed(&self) -> Option<HashSet<Step>>; // Provided methods fn choose_mode_list() -> Vec<Mode> { ... } fn is_legacy() -> bool { ... } fn has_preload() -> bool { ... } fn insert_editor_state_step_completed(&mut self, step: Step) { ... } fn convert_to_body(&self, kind: ModuleKind) -> Result<Body, &'static str> { ... }
}
Expand description

Extension trait for interop impl on inner body data

Required Methods§

Source

fn as_body(&self) -> Body

get self as a Body

Source

fn is_complete(&self) -> bool

is complete

Source

fn kind() -> ModuleKind

get the kind from the type itself

Source

fn new_with_mode_and_theme(mode: Mode, theme_id: ThemeId) -> Self

given a Mode, get a new Self will usually populate an inner .content

Source

fn mode(&self) -> Option<Mode>

Fetch the mode for this module

Source

fn requires_choose_mode(&self) -> bool

requires an additional step of choosing the mode

Source

fn get_theme(&self) -> Option<ThemeId>

Get the current theme

Source

fn set_theme(&mut self, theme_id: ThemeId)

Set the current theme

Source

fn set_editor_state_step(&mut self, step: Step)

Set editor state step

Source

fn set_editor_state_steps_completed(&mut self, steps_completed: HashSet<Step>)

Set editor state steps completed

Source

fn get_editor_state_step(&self) -> Option<Step>

Get editor state step

Source

fn get_editor_state_steps_completed(&self) -> Option<HashSet<Step>>

Get editor state steps completed

Provided Methods§

Source

fn choose_mode_list() -> Vec<Mode>

get choose mode list. By default it’s the full list but that can be overridden to re-order or hide some modes

Source

fn is_legacy() -> bool

is legacy

Source

fn has_preload() -> bool

should wait for manual phase change to Init

Source

fn insert_editor_state_step_completed(&mut self, step: Step)

Insert a completed step

Source

fn convert_to_body(&self, kind: ModuleKind) -> Result<Body, &'static str>

Convert this inner data to a Body wrapper of a specific kind

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl BodyExt<Mode, Step> for shared::domain::module::body::card_quiz::ModuleData

Module is a memory game, and has a memory game’s body.

Source§

impl BodyExt<Mode, Step> for shared::domain::module::body::flashcards::ModuleData

Source§

impl BodyExt<Mode, Step> for shared::domain::module::body::matching::ModuleData

Source§

impl BodyExt<Mode, Step> for shared::domain::module::body::memory::ModuleData

Source§

impl BodyExt<Mode, Step> for shared::domain::module::body::drag_drop::ModuleData

Source§

impl BodyExt<Mode, Step> for shared::domain::module::body::embed::ModuleData

Source§

impl BodyExt<Mode, Step> for shared::domain::module::body::find_answer::ModuleData

Source§

impl BodyExt<Mode, Step> for shared::domain::module::body::poster::ModuleData

Source§

impl BodyExt<Mode, Step> for shared::domain::module::body::tapping_board::ModuleData

Source§

impl BodyExt<Mode, Step> for shared::domain::module::body::video::ModuleData

Source§

impl BodyExt<(), Step> for shared::domain::module::body::cover::ModuleData

Source§

impl BodyExt<(), Step> for shared::domain::module::body::resource_cover::ModuleData

Source§

impl BodyExt<(), ()> for shared::domain::module::body::legacy::ModuleData