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 (“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 no width, and how its images fit their cards
("cover" or "contain").
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).