fn extendable(&self) -> bool;
fn single_id(&self) -> String {
- panic!("Should only call this if the FileType sets CAN_LIST, CAN_GET_POSTS or IS_EXAMINE_USER");
+ panic!("Should only call this if the FileType sets can_list(), CAN_GET_POSTS or IS_EXAMINE_USER");
}
fn want_to_jump_to_new_content(&self) -> bool {
trait FileType {
type Item: TextFragment + Sized;
- const CAN_LIST: CanList = CanList::Nothing;
const CAN_GET_POSTS: bool = false;
const IS_EXAMINE_USER: bool = false;
fn feed_id(&self) -> Option<&FeedId> {
None
}
+
+ fn can_list(&self) -> CanList {
+ CanList::Nothing
+ }
}
struct StatusFeedType {
} else {
fs
};
- let fs = if Type::CAN_LIST != CanList::Nothing {
+ let fs = if self.file_desc.can_list() != CanList::Nothing {
fs.add(Pr('l'), "List", 40)
} else {
fs
)
}
UIMode::ListSubmenu => {
- let fs = match Type::CAN_LIST {
+ let fs = match self.file_desc.can_list() {
CanList::ForUser => fs
.add(Pr('I'), "List Followers", 99)
.add(Pr('O'), "List Followed", 99),
}
Pr('l') | Pr('L') => {
- if Type::CAN_LIST != CanList::Nothing {
+ if self.file_desc.can_list() != CanList::Nothing {
self.ui_mode = UIMode::ListSubmenu;
}
LogicalAction::Nothing
},
UIMode::ListSubmenu => match key {
Pr('f') | Pr('F') => {
- if Type::CAN_LIST == CanList::ForPost {
+ if self.file_desc.can_list() == CanList::ForPost {
LogicalAction::Goto(
UtilityActivity::ListStatusFavouriters(
self.contents.source.single_id(),
}
Pr('b') | Pr('B') => {
- if Type::CAN_LIST == CanList::ForPost {
+ if self.file_desc.can_list() == CanList::ForPost {
LogicalAction::Goto(
UtilityActivity::ListStatusBoosters(
self.contents.source.single_id(),
}
Pr('i') | Pr('I') => {
- if Type::CAN_LIST == CanList::ForUser {
+ if self.file_desc.can_list() == CanList::ForUser {
LogicalAction::Goto(
UtilityActivity::ListUserFollowers(
self.contents.source.single_id(),
}
Pr('o') | Pr('O') => {
- if Type::CAN_LIST == CanList::ForUser {
+ if self.file_desc.can_list() == CanList::ForUser {
LogicalAction::Goto(
UtilityActivity::ListUserFollowees(
self.contents.source.single_id(),
struct ExamineUserFileType {}
impl FileType for ExamineUserFileType {
type Item = ExamineUserDisplay;
- const CAN_LIST: CanList = CanList::ForUser;
const CAN_GET_POSTS: bool = true;
const IS_EXAMINE_USER: bool = true;
let ac = client.account_by_id(id)?;
ExamineUserDisplay::new(ac, client)
}
+
+ fn can_list(&self) -> CanList {
+ CanList::ForUser
+ }
}
pub fn examine_user(
struct DetailedStatusFileType {}
impl FileType for DetailedStatusFileType {
type Item = DetailedStatusDisplay;
- const CAN_LIST: CanList = CanList::ForPost;
fn get_item(
&self,
let st = client.status_by_id(id)?;
Ok(DetailedStatusDisplay::new(st, client))
}
+
+ fn can_list(&self) -> CanList {
+ CanList::ForPost
+ }
}
pub fn view_single_post(