egui_charts/services/posts.rs
1//! Content of the posts and ideas that drawings link to.
2
3use crate::data::{MaybeSend, Reply};
4use crate::model::PostContent;
5
6/// Host service that resolves the link of a post or idea drawing into its content. Attach with
7/// `Chart::set_post_source`.
8///
9/// Called on the UI thread; return promptly and answer through the reply from any thread,
10/// runtime or browser task. The chart never fetches a link itself. It asks once for each link
11/// whose content it lacks, gives the answer to every drawing with that link and saves it with
12/// them. An error, or a reply dropped unanswered, shows the link as not loaded until the source
13/// is set again or the drawing is loaded again.
14pub trait Posts: MaybeSend + 'static {
15 /// The content `link` names: an address the user typed, or the host's reference to a post
16 /// or idea, such as a feed entry identifier. It may be any text; check it before fetching.
17 fn resolve(&self, link: &str, reply: Reply<PostContent>);
18}