shared::domain::module::body

Enum Body

Source
#[non_exhaustive]
pub enum Body {
Show 13 variants MemoryGame(ModuleData), Matching(ModuleData), Flashcards(ModuleData), CardQuiz(ModuleData), Poster(ModuleData), Video(ModuleData), Embed(ModuleData), TappingBoard(ModuleData), DragDrop(ModuleData), Cover(ModuleData), ResourceCover(ModuleData), FindAnswer(ModuleData), Legacy(ModuleData),
}
Expand description

Body kinds for Modules.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

MemoryGame(ModuleData)

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

§

Matching(ModuleData)

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

§

Flashcards(ModuleData)

Module is flashcards, and has a flashcard’s body.

§

CardQuiz(ModuleData)

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

§

Poster(ModuleData)

Module is a poster, and has a talking poster’s body.

§

Video(ModuleData)

Module is a Video, and has a video body.

§

Embed(ModuleData)

Module is a Embed, and has a embed body.

§

TappingBoard(ModuleData)

Module is a Listen & Learn, and has a Listen & Learn’s body.

§

DragDrop(ModuleData)

Module is a drag & drop, and has a drag & drop’s body.

§

Cover(ModuleData)

Module is a Cover.

Cover for Module type

§

ResourceCover(ModuleData)

Module is a Resource Cover.

§

FindAnswer(ModuleData)

Module is a Answer This (Find the Answer), and has Answer This’s (Find the Answer)’s body.

§

Legacy(ModuleData)

Module is a legacy, and has a legacy’s body.

Implementations§

Source§

impl Body

Source

pub fn try_as_memory_game(self) -> Option<ModuleData>

Source

pub const fn try_as_memory_game_ref(&self) -> Option<&ModuleData>

Source

pub fn try_as_memory_game_mut(&mut self) -> Option<&mut ModuleData>

Source

pub fn try_as_matching(self) -> Option<ModuleData>

Source

pub const fn try_as_matching_ref(&self) -> Option<&ModuleData>

Source

pub fn try_as_matching_mut(&mut self) -> Option<&mut ModuleData>

Source

pub fn try_as_flashcards(self) -> Option<ModuleData>

Source

pub const fn try_as_flashcards_ref(&self) -> Option<&ModuleData>

Source

pub fn try_as_flashcards_mut(&mut self) -> Option<&mut ModuleData>

Source

pub fn try_as_card_quiz(self) -> Option<ModuleData>

Source

pub const fn try_as_card_quiz_ref(&self) -> Option<&ModuleData>

Source

pub fn try_as_card_quiz_mut(&mut self) -> Option<&mut ModuleData>

Source

pub fn try_as_poster(self) -> Option<ModuleData>

Source

pub const fn try_as_poster_ref(&self) -> Option<&ModuleData>

Source

pub fn try_as_poster_mut(&mut self) -> Option<&mut ModuleData>

Source

pub fn try_as_video(self) -> Option<ModuleData>

Source

pub const fn try_as_video_ref(&self) -> Option<&ModuleData>

Source

pub fn try_as_video_mut(&mut self) -> Option<&mut ModuleData>

Source

pub fn try_as_embed(self) -> Option<ModuleData>

Source

pub const fn try_as_embed_ref(&self) -> Option<&ModuleData>

Source

pub fn try_as_embed_mut(&mut self) -> Option<&mut ModuleData>

Source

pub fn try_as_tapping_board(self) -> Option<ModuleData>

Source

pub const fn try_as_tapping_board_ref(&self) -> Option<&ModuleData>

Source

pub fn try_as_tapping_board_mut(&mut self) -> Option<&mut ModuleData>

Source

pub fn try_as_drag_drop(self) -> Option<ModuleData>

Source

pub const fn try_as_drag_drop_ref(&self) -> Option<&ModuleData>

Source

pub fn try_as_drag_drop_mut(&mut self) -> Option<&mut ModuleData>

Source

pub fn try_as_cover(self) -> Option<ModuleData>

Source

pub const fn try_as_cover_ref(&self) -> Option<&ModuleData>

Source

pub fn try_as_cover_mut(&mut self) -> Option<&mut ModuleData>

Source

pub fn try_as_resource_cover(self) -> Option<ModuleData>

Source

pub const fn try_as_resource_cover_ref(&self) -> Option<&ModuleData>

Source

pub fn try_as_resource_cover_mut(&mut self) -> Option<&mut ModuleData>

Source

pub fn try_as_find_answer(self) -> Option<ModuleData>

Source

pub const fn try_as_find_answer_ref(&self) -> Option<&ModuleData>

Source

pub fn try_as_find_answer_mut(&mut self) -> Option<&mut ModuleData>

Source

pub fn try_as_legacy(self) -> Option<ModuleData>

Source

pub const fn try_as_legacy_ref(&self) -> Option<&ModuleData>

Source

pub fn try_as_legacy_mut(&mut self) -> Option<&mut ModuleData>

Source§

impl Body

Source

pub fn new(kind: ModuleKind) -> Self

create a new Body for a given ModuleKind

Source

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

Convert this container to a Body wrapper of a specific kind

Source

pub fn is_complete(&self) -> bool

Helper to check whether the inner data is complete

Source§

impl Body

Source

pub fn kind(&self) -> ModuleKind

Gets this body’s related ModuleKind

Source§

impl ModuleBody

Source

pub fn map_module_contents(body: &Self) -> Result<(ModuleKind, Value)>

Maps module content from request body

Source

pub fn transform_response_kind( contents: Value, kind: ModuleKind, ) -> Result<Self>

Transforms module content from database

Trait Implementations§

Source§

impl Clone for Body

Source§

fn clone(&self) -> Body

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Body

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Body

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Body

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<Body> for ModuleData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_from(body: Body) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Body> for ModuleData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_from(body: Body) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Body> for ModuleData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_from(body: Body) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Body> for ModuleData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_from(body: Body) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Body> for ModuleData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_from(body: Body) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Body> for ModuleData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_from(body: Body) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Body> for ModuleData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_from(body: Body) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Body> for ModuleData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_from(body: Body) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Body> for ModuleData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_from(body: Body) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Body> for ModuleData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_from(body: Body) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Body> for ModuleData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_from(body: Body) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Body> for ModuleData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_from(body: Body) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Body> for ModuleData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_from(body: Body) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for Body

§

impl RefUnwindSafe for Body

§

impl Send for Body

§

impl Sync for Body

§

impl Unpin for Body

§

impl UnwindSafe for Body

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T