[][src]Struct webbundle::Builder

pub struct Builder { /* fields omitted */ }

A Bundle builder.

Methods

impl Builder[src]

pub fn version(self, version: Version) -> Self[src]

Sets the version.

pub fn primary_url(self, primary_url: Uri) -> Self[src]

Sets the primary url.

pub fn manifest(self, manifest: Uri) -> Self[src]

Sets the manifest url.

pub fn exchange(self, exchange: Exchange) -> Self[src]

Adds the exchange.

pub async fn exchanges_from_dir(
    __arg0: Self,
    dir: impl AsRef<Path>,
    base_url: Url
) -> Result<Self>
[src]

Append exchanges from files rooted at the given directory.

base_url will be used as a prefix for each resource. A relative path from the given directory to each file is appended to base_url.

One exchange is created for each file, however, two exchanges are created for index.html file, as follows:

  1. The pareent directory serves the contents of index.html file.
  2. The URL for index.html file is a redirect to the parent directory (301 MOVED PERMANENTLY).

Examples

use webbundle::{Bundle, Version};
let bundle = Bundle::builder()
    .version(Version::VersionB1)
    .primary_url("https://example.com/".parse()?)
    .exchanges_from_dir("build", "https://example.com".parse()?).await?
    .build()?;

pub fn build(self) -> Result<Bundle>[src]

Builds the bundle.

Trait Implementations

impl Default for Builder[src]

Auto Trait Implementations

impl !RefUnwindSafe for Builder

impl Send for Builder

impl Sync for Builder

impl Unpin for Builder

impl !UnwindSafe for Builder

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.