pub struct Options { /* private fields */ }Expand description
The options a site can set (contract/SPEC.md, “Input”), as JSON-shaped values so every renderer takes the same
ones. Build them with Options::default and the setters, or Options::from_json.
Implementations§
Source§impl Options
impl Options
Sourcepub fn from_json(value: &Value) -> Result<Self, Error>
pub fn from_json(value: &Value) -> Result<Self, Error>
Options from a JSON object with the contract’s names (headingLevel, groupOrder, themeSwitch, seeAll).
Sourcepub fn title(self, title: Option<&str>) -> Self
pub fn title(self, title: Option<&str>) -> Self
The gallery’s heading and accessible name; None keeps the name (text label, “Screenshots”) but shows no
heading.
pub fn heading_level(self, level: u8) -> Self
pub fn id(self, id: &str) -> Self
Sourcepub fn screen(
self,
key: &str,
title: Option<&str>,
caption: Option<&str>,
) -> Self
pub fn screen( self, key: &str, title: Option<&str>, caption: Option<&str>, ) -> Self
A screen’s title and caption, by key (ios/usage, overview).
pub fn order<S: AsRef<str>>(self, keys: &[S]) -> Self
Sourcepub fn group(
self,
name: &str,
title: Option<&str>,
size: Option<&str>,
fit: Option<&str>,
) -> Self
pub fn group( self, name: &str, title: Option<&str>, size: Option<&str>, fit: Option<&str>, ) -> Self
A group’s title, the size of its shots whose names give none (a value of the size dimension: "desktop" or
"phone" by default), and how its images fit their cards ("cover" or "contain").
Sourcepub fn dimension(
self,
key: &str,
label: Option<&str>,
missing: Option<&str>,
values: &[(&str, Option<&str>, Option<u64>)],
) -> Self
pub fn dimension( self, key: &str, label: Option<&str>, missing: Option<&str>, values: &[(&str, Option<&str>, Option<u64>)], ) -> Self
A dimension (contract/SPEC.md, “Dimensions”): theme or size changes the built-in one, any other key adds
one after them, in the order of the calls. missing is "error", "hide" or "first"; values are
(key, label, below), where below is only for sizes. None or an empty values keeps the built-in one’s
(a new dimension needs values).
pub fn group_order<S: AsRef<str>>(self, names: &[S]) -> Self
pub fn credit(self, on: bool) -> Self
Sourcepub fn layout(self, layout: &str) -> Self
pub fn layout(self, layout: &str) -> Self
"grid" (tabs per group) or "strip" (one row that scrolls sideways).
pub fn theme_switch(self, on: bool) -> Self
pub fn see_all(self, href: &str, text: Option<&str>) -> Self
Sourcepub fn preload(self, on: bool) -> Self
pub fn preload(self, on: bool) -> Self
Predictive preloading of the images a reader is likely to look at next: on by default, false turns it off.
Sourcepub fn preload_caps(
self,
fold: Option<u64>,
count: Option<u64>,
bytes: Option<u64>,
parallel: Option<u64>,
) -> Self
pub fn preload_caps( self, fold: Option<u64>, count: Option<u64>, bytes: Option<u64>, parallel: Option<u64>, ) -> Self
Preloading with caps of the site’s own: fold above-the-fold thumbnails always load, past them at most count
images and bytes bytes, parallel requests at once (1 to 8). None keeps a cap’s default (250, 500,
50000000, 4).
Sourcepub fn deep_links(self, on: bool) -> Self
pub fn deep_links(self, on: bool) -> Self
The URL’s hash names the shown tab, the open screen and the chosen values, so a link opens them. Off by default: the gallery leaves the page’s URL alone.
Sourcepub fn search(self, on: bool) -> Self
pub fn search(self, on: bool) -> Self
The grid’s search box, which filters the cards by title and caption across tabs: true always shows it,
false never. By default it shows once the gallery has 40 screens; the strip never has one.
Sourcepub fn search_from(self, screens: u64) -> Self
pub fn search_from(self, screens: u64) -> Self
The grid’s search box, shown once the gallery has this many screens (in every group), from 0 to 1000000.
Sourcepub fn zoom(self, on: bool) -> Self
pub fn zoom(self, on: bool) -> Self
Zoom in the full-size view, by gestures and keys only: on by default, false turns it off.
Sourcepub fn new_badges(self, on: bool) -> Self
pub fn new_badges(self, on: bool) -> Self
A New badge on each screen whose picture changed in the last 30 days (true); off by default.
Sourcepub fn new_badges_days(self, days: u64) -> Self
pub fn new_badges_days(self, days: u64) -> Self
A New badge on each screen whose picture changed in the last days days, from 1 to 3650.
Sourcepub fn versions(self, on: bool) -> Self
pub fn versions(self, on: bool) -> Self
The Version switch, when the manifest lists versions: Latest and each release the project reported, the grid only. Off by default.
Sourcepub fn text(self, key: &str, value: &str) -> Self
pub fn text(self, key: &str, value: &str) -> Self
One of the gallery’s own words, by key (contract/SPEC.md, “Text”): label, open ({title} is the screen’s
title), previous, next, close, back, forward, credit ({link} is the link to VisualCI), and,
search, empty, new, change ({title} is the screen’s title), version or latest. An unknown key makes
the options invalid.