leetcode_tui_core/
content.rs

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
pub mod question;
use question::Questions;
use topic::Topic;

pub mod topic;

pub mod questions {}

pub struct MainContent {
    topic: Topic,
    questions: Questions,
    visible: bool,
}

impl MainContent {
    pub fn is_visible(&self) -> bool {
        self.visible
    }
}

impl MainContent {
    pub async fn new() -> Self {
        Self {
            topic: Topic::new().await,
            questions: Default::default(),
            visible: true,
        }
    }

    pub fn get_topic_mut(&mut self) -> &mut Topic {
        &mut self.topic
    }

    pub fn get_topic(&self) -> &Topic {
        &self.topic
    }

    pub fn get_questions_mut(&mut self) -> &mut Questions {
        &mut self.questions
    }

    pub fn get_questions(&self) -> &Questions {
        &self.questions
    }
}