const CAN_GET_POSTS: bool = false;
const IS_EXAMINE_USER: bool = false;
- fn get_from_client(
+ fn get_item(
+ &self,
id: &str,
client: &mut Client,
) -> Result<Self::Item, ClientError>;
impl FileType for StatusFeedType {
type Item = StatusDisplay;
- fn get_from_client(
+ fn get_item(
+ &self,
id: &str,
client: &mut Client,
) -> Result<Self::Item, ClientError> {
impl FileType for NotificationStatusFeedType {
type Item = StatusDisplay;
- fn get_from_client(
+ fn get_item(
+ &self,
id: &str,
client: &mut Client,
) -> Result<Self::Item, ClientError> {
impl FileType for EgoNotificationFeedType {
type Item = NotificationLog;
- fn get_from_client(
+ fn get_item(
+ &self,
id: &str,
client: &mut Client,
) -> Result<Self::Item, ClientError> {
impl FileType for UserListFeedType {
type Item = UserListEntry;
- fn get_from_client(
+ fn get_item(
+ &self,
id: &str,
client: &mut Client,
) -> Result<Self::Item, ClientError> {
}
impl<Type: FileType, Source: FileDataSource> FileContents<Type, Source> {
- fn update_items(&mut self, client: &mut Client) {
+ fn update_items(&mut self, file_desc: &Type, client: &mut Client) {
// FIXME: if the feed has been extended rather than created,
// we should be able to make less effort than this. But we
// still need to regenerate any item derived from something we
self.items.clear();
for id in ids {
- let item = Type::get_from_client(&id, client)
+ let item = file_desc
+ .get_item(&id, client)
.expect("Any id stored in a Feed should also be cached");
self.items.push((id.to_owned(), item));
}
items: Vec::new(),
};
- contents.update_items(client);
+ contents.update_items(&file_desc, client);
// Start with the initial position at the file top
let mut initial_pos = FilePosition::item_top(contents.first_index());
}
}
- self.contents.update_items(client);
+ self.contents.update_items(&self.file_desc, client);
self.clip_pos_within_item();
self.fix_overshoot_at_top(); // in case the extender vanished
Ok(())
SelectionPurpose::Favourite => {
match client.favourite_post(&id, !alt) {
Ok(_) => {
- self.contents.update_items(client);
+ self.contents
+ .update_items(&self.file_desc, client);
LogicalAction::Nothing
}
Err(_) => LogicalAction::Beep,
SelectionPurpose::Boost => {
match client.boost_post(&id, !alt) {
Ok(_) => {
- self.contents.update_items(client);
+ self.contents
+ .update_items(&self.file_desc, client);
LogicalAction::Nothing
}
Err(_) => LogicalAction::Beep,
.copied(),
) {
Ok(_) => {
- self.contents.update_items(client);
+ self.contents
+ .update_items(&self.file_desc, client);
LogicalAction::Nothing
}
Err(_) => LogicalAction::Beep,
client: &mut Client,
) {
if self.contents.source.updated(feeds_updated) {
- self.contents.update_items(client);
+ self.contents.update_items(&self.file_desc, client);
self.ensure_enough_rendered();
// If someone's home feed was almost completely empty,
}
fn show_new_content(&mut self, client: &mut Client) {
- self.contents.update_items(client);
+ self.contents.update_items(&self.file_desc, client);
if let Some(index) = self.latest_read_index {
if self.contents.last_index() > index {
self.pos = FilePosition::item_top(index + 1);
const CAN_GET_POSTS: bool = true;
const IS_EXAMINE_USER: bool = true;
- fn get_from_client(
+ fn get_item(
+ &self,
id: &str,
client: &mut Client,
) -> Result<Self::Item, ClientError> {
type Item = DetailedStatusDisplay;
const CAN_LIST: CanList = CanList::ForPost;
- fn get_from_client(
+ fn get_item(
+ &self,
id: &str,
client: &mut Client,
) -> Result<Self::Item, ClientError> {
impl FileType for InstanceRulesFileType {
type Item = InstanceRulesDisplay;
- fn get_from_client(
+ fn get_item(
+ &self,
_id: &str,
client: &mut Client,
) -> Result<Self::Item, ClientError> {