Struct Project

Source
pub struct Project { /* private fields */ }

Implementations§

Source§

impl Project

Source

pub fn file(&mut self, name: &str, contents: &str) -> &mut Project

Add a new file with the specified contents to this project, the name can have slahes for files in subdirectories.

Source

pub fn debug(&mut self, debug: bool) -> &mut Project

Enable debug mode in wasm-bindgen for this test

Source

pub fn no_std(&mut self, no_std: bool) -> &mut Project

Depend on wasm-bindgen without the std feature enabled.

Source

pub fn serde(&mut self, serde: bool) -> &mut Project

Depend on the serde feature of wasm-bindgen

Source

pub fn rlib(&mut self, rlib: bool) -> &mut Project

Generate an rlib instead of a cdylib in the generated Cargo project

Source

pub fn depend(&mut self, dep: &str) -> &mut Project

Depend on a crate from crates.io, like serde.

Source

pub fn nodejs_experimental_modules(&mut self, node: bool) -> &mut Project

Enables or disables node.js experimental modules output

Source

pub fn webpack(&mut self, webpack: bool) -> &mut Project

Enables or disables the usage of webpack for this project

Source

pub fn add_local_dependency(&mut self, name: &str, path: &str) -> &mut Project

Add a path dependency to the generated project

Source

pub fn crate_name(&self) -> String

Returns the crate name that will be used for the generated crate, this name changes between test runs and is generated at runtime.

Source

pub fn requires_bigint(&mut self) -> &mut Project

Flag this project as requiring bigint support in Node

Source

pub fn headless(&mut self, headless: bool) -> &mut Project

This test requires a headless web browser

Source

pub fn build(&mut self) -> (PathBuf, PathBuf)

Write this project to the filesystem, ensuring all files are ready to go.

Source

pub fn cargo_build(&mut self) -> (PathBuf, PathBuf)

Build the Cargo project for the wasm target, returning the root of the project and the target directory where output is located.

Source

pub fn gen_bindings(&mut self) -> (PathBuf, PathBuf)

Generate wasm-bindgen bindings for the compiled artifacts of this project, returning the root of the project as well as the target directory where output was generated.

Source

pub fn test(&mut self)

Execute this project’s run.js, ensuring that everything runs through node or a browser correctly

Source

pub fn read_js(&self) -> String

Reads JS generated by wasm-bindgen to a string.

Trait Implementations§

Source§

impl Clone for Project

Source§

fn clone(&self) -> Project

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.