Skip to main content

LinkPreview

Type Alias LinkPreview 

Source
pub type LinkPreview = fn(url: &str, cx: &App) -> Option<Preview>;
Expand description

None for a URL the caller has nothing for yet: the card paints its host and repaints when the answer arrives.

cx is how the answer is found: a cache lives in the app, so a bare call with only the URL would have to reach for a static to read its own. Shared rather than exclusive because this is asked at paint — the fetch it misses belongs to whatever notices the None, not to the paint that returned it.