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]
impl<'s, 'i, 'r> Manifest<'s, 'i, 'r>
pub fn builder(name: &'s str) -> Self
[src]
pub fn builder(name: &'s str) -> Self
Create a new instance.
Example
let name = "My Cool Application"; let builder = Manifest::builder(name);
pub fn build(self) -> Result<String, Error>
[src]
pub fn build(self) -> Result<String, Error>
Finalize the builder and create the manifest.
Example
let name = "My Cool Application"; let manifest = Manifest::builder(name).build()?;
pub fn pretty(self) -> Result<String, Error>
[src]
pub fn pretty(self) -> Result<String, Error>
Finalize the builder and create a pretty representation of the manifest.
Example
let name = "My Cool Application"; let manifest = Manifest::builder(name).pretty()?;
pub fn short_name(self, val: &'s str) -> Self
[src]
pub fn short_name(self, val: &'s str) -> Self
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()?;
pub fn start_url(self, val: &'s str) -> Self
[src]
pub fn start_url(self, val: &'s str) -> Self
Set the start_url
value.
Example
let name = "My Cool Application"; let manifest = Manifest::builder(name) .start_url(".") .build()?;
pub fn display_mode(self, val: DisplayMode) -> Self
[src]
pub fn display_mode(self, val: DisplayMode) -> Self
Set the display
value.
Example
let name = "My Cool Application"; let manifest = Manifest::builder(name) .display_mode(DisplayMode::Standalone) .build()?;
pub fn bg_color(self, val: &'s str) -> Self
[src]
pub fn bg_color(self, val: &'s str) -> Self
Set the background_color
value.
Example
let name = "My Cool Application"; let manifest = Manifest::builder(name) .bg_color("#000") .build()?;
pub fn theme_color(self, val: &'s str) -> Self
[src]
pub fn theme_color(self, val: &'s str) -> Self
Set the theme_color
value.
Example
let name = "My Cool Application"; let manifest = Manifest::builder(name) .theme_color("#000") .build()?;
pub fn description(self, val: &'s str) -> Self
[src]
pub fn description(self, val: &'s str) -> Self
Set the description
value.
Example
let name = "My Cool Application"; let desc = "It does many things."; let manifest = Manifest::builder(name) .description(desc) .build()?;
pub fn lang(self, val: &'s str) -> Self
[src]
pub fn lang(self, val: &'s str) -> Self
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()?;
pub fn orientation(self, val: Orientation) -> Self
[src]
pub fn orientation(self, val: Orientation) -> Self
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()?;
pub fn direction(self, val: Direction) -> Self
[src]
pub fn direction(self, val: Direction) -> Self
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()?;
pub fn scope(self, val: &'s str) -> Self
[src]
pub fn scope(self, val: &'s str) -> Self
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()?;
pub fn icon(self, val: &'i Icon) -> Self
[src]
pub fn icon(self, val: &'i Icon) -> Self
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]
impl<'s, 'i, 'r> Debug for Manifest<'s, 'i, 'r>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'s, 'i, 'r> Clone for Manifest<'s, 'i, 'r>
[src]
impl<'s, 'i, 'r> Clone for Manifest<'s, 'i, 'r>