-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregistry.rs
More file actions
50 lines (45 loc) · 1.33 KB
/
Copy pathregistry.rs
File metadata and controls
50 lines (45 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! Quest registry — single ordered list of all 14 quests.
//!
//! When adding a quest, register it here in learning order.
use crate::game::quiz::QuizQuestion;
use crate::resources::links::ResourceLinks;
use super::{
advanced_cargo, cargo, collections, concurrency, errors, iterators_closures, lifetimes,
modules_prelude, ownership, smart_pointers, structs_enums, testing_docs, traits_generics,
types,
};
/// One playable quest in Rust Quest.
#[derive(Clone, Copy)]
pub struct Quest {
pub id: &'static str,
pub order: u8,
pub emoji: &'static str,
pub title: &'static str,
pub demo: fn() -> String,
pub memory_note: &'static str,
pub questions: &'static [QuizQuestion],
pub boss: QuizQuestion,
pub links: ResourceLinks,
}
/// All quests in recommended learning order.
pub fn all() -> &'static [Quest] {
&[
cargo::QUEST,
types::QUEST,
ownership::QUEST,
structs_enums::QUEST,
errors::QUEST,
collections::QUEST,
traits_generics::QUEST,
lifetimes::QUEST,
modules_prelude::QUEST,
iterators_closures::QUEST,
smart_pointers::QUEST,
concurrency::QUEST,
testing_docs::QUEST,
advanced_cargo::QUEST,
]
}
pub fn find(id: &str) -> Option<Quest> {
all().iter().find(|q| q.id == id).copied()
}