Skip to main content

Options

Struct Options 

Source
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

Source

pub fn from_json(value: &Value) -> Result<Self, Error>

Options from a JSON object with the contract’s names (headingLevel, groupOrder, themeSwitch, seeAll).

Source

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.

Source

pub fn heading_level(self, level: u8) -> Self

Source

pub fn id(self, id: &str) -> Self

Source

pub fn screen( self, key: &str, title: Option<&str>, caption: Option<&str>, ) -> Self

A screen’s title and caption, by key (ios/usage, overview).

Source

pub fn order<S: AsRef<str>>(self, keys: &[S]) -> Self

Source

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").

Source

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).

Source

pub fn group_order<S: AsRef<str>>(self, names: &[S]) -> Self

Source

pub fn credit(self, on: bool) -> Self

Source

pub fn layout(self, layout: &str) -> Self

"grid" (tabs per group) or "strip" (one row that scrolls sideways).

Source

pub fn theme_switch(self, on: bool) -> Self

Source

pub fn see_all(self, href: &str, text: Option<&str>) -> Self

Source

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.

Source

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).

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Options

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Options

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Forget for Options

§

impl Freeze for Options
where *const LeafNode<String, Value> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(String, Value)>>: Freeze,

§

impl Move for Options

§

impl RefUnwindSafe for Options

§

impl Send for Options
where NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send,

§

impl Sync for Options
where NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync,

§

impl Unpin for Options
where *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin,

§

impl UnsafeUnpin for Options
where *const LeafNode<String, Value> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(String, Value)>>: UnsafeUnpin,

§

impl UnwindSafe for Options

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.