Struct webmanifest::Manifest[][src]

pub struct Manifest<'s, 'i, 'r> { /* fields omitted */ }

Create a new manifest builder.

Methods

impl<'s, 'i, 'r> Manifest<'s, 'i, 'r>
[src]

Create a new instance.

Example

let name = "My Cool Application";
let builder = Manifest::builder(name);

Finalize the builder and create the manifest.

Example

let name = "My Cool Application";
let manifest = Manifest::builder(name).build()?;

Finalize the builder and create a pretty representation of the manifest.

Example

let name = "My Cool Application";
let manifest = Manifest::builder(name).pretty()?;

Set the short_name value.

Panics

This will panic if the short name exceeds 12 characters.

Example

let name = "My Cool Application";
let manifest = Manifest::builder(name)
  .short_name("Cool App")
  .build()?;

Set the start_url value.

Example

let name = "My Cool Application";
let manifest = Manifest::builder(name)
  .start_url(".")
  .build()?;

Set the display value.

Example

let name = "My Cool Application";
let manifest = Manifest::builder(name)
  .display_mode(DisplayMode::Standalone)
  .build()?;

Set the background_color value.

Example

let name = "My Cool Application";
let manifest = Manifest::builder(name)
  .bg_color("#000")
  .build()?;

Set the theme_color value.

Example

let name = "My Cool Application";
let manifest = Manifest::builder(name)
  .theme_color("#000")
  .build()?;

Set the description value.

Example

let name = "My Cool Application";
let desc = "It does many things.";
let manifest = Manifest::builder(name)
  .description(desc)
  .build()?;

Set the lang value.

Specifies the primary language for the values in the name and short_name members. This value is a string containing a single language tag.

Example

let name = "My Cool Application";
let lang = "en-US";
let manifest = Manifest::builder(name)
  .lang(lang)
  .build()?;

Set the orientation value.

Specifies a boolean value that hints for the user agent to indicate to the user that the specified native applications are recommended over the website. This should only be used if the related native apps really do offer something that the website can't.

Example

let name = "My Cool Application";
let manifest = Manifest::builder(name)
  .orientation(Orientation::Portrait)
  .build()?;

Set the dir value.

Specifies the primary text direction for the name, short_name, and description members. Together with the lang member, it helps the correct display of right-to-left languages.

Example

let name = "My Cool Application";
let lang = "en-US";
let manifest = Manifest::builder(name)
  .direction(Direction::Ltr)
  .build()?;

Set the prefer_related_applications value.

Specifies a boolean value that hints for the user agent to indicate to the user that the specified native applications are recommended over the website. This should only be used if the related native apps really do offer something that the website can't.

Note

If omitted, the value defaults to false.

Example

let name = "My Cool Application";
let manifest = Manifest::builder(name)
  .prefer_related_applications(true)
  .build()?;

Set the scope value.

Defines the navigation scope of this website's context. This restricts what web pages can be viewed while the manifest is applied. If the user navigates outside the scope, it returns to a normal web page inside a browser tab/window.

If the scope is a relative URL, the base URL will be the URL of the manifest.

Example

let name = "My Cool Application";
let manifest = Manifest::builder(name)
  .scope("/myapp/")
  .build()?;

Add an Icon to the icons vector.

Example

let name = "My Cool Application";
let src = "images/touch/homescreen48.png";
let manifest = Manifest::builder(name)
  .icon(&Icon::new(&src, "48x48"))
  .build()?;

Add an Related application to the related_applications vector.

Example

let name = "My Cool Application";
let url = "https://play.google.com/store/apps/details?id=cheeaun.hackerweb";
let manifest = Manifest::builder(name)
  .related(&Related::new("play", url))
  .build()?;

Trait Implementations

impl<'s, 'i, 'r> Debug for Manifest<'s, 'i, 'r>
[src]

Formats the value using the given formatter. Read more

impl<'s, 'i, 'r> Clone for Manifest<'s, 'i, 'r>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<'s, 'i, 'r> Send for Manifest<'s, 'i, 'r>

impl<'s, 'i, 'r> Sync for Manifest<'s, 'i, 'r>