Skip to main content

Project

Struct Project 

Source
pub struct Project {
    pub dir: PathBuf,
    pub name: String,
    pub code: String,
    pub current: String,
    pub assets: Assets,
}
Expand description

A loaded project: code + assets + where they live.

Fields§

§dir: PathBuf§name: String

Crate name (also the wasm artifact name, with - mapped to _).

§code: String§current: String

Path (relative to src/) of the file currently held in code.

§assets: Assets

Implementations§

Source§

impl Project

Source

pub fn create(dir: &Path, name: &str) -> Result<Self>

Create a fresh project directory with template code and empty assets.

Source

pub fn load(dir: &Path) -> Result<Self>

Load an existing project directory.

Source

pub fn save(&self) -> Result<()>

Write the open file and assets back to disk.

Source

pub fn file_names(&self) -> Vec<String>

The *.rs files directly under src/, sorted with lib.rs first.

Source

pub fn switch_to(&mut self, name: &str) -> Result<()>

Persist nothing here; load src/<name> into code and make it current.

Source

pub fn create_file(&mut self, name: &str) -> Result<String>

Create a new flat module under src/, wire it into lib.rs, and open it.

Source

pub fn lib_source(&self) -> String

The lib.rs source, regardless of which file is open. Used for the source embedded in an exported cart.

Source

pub fn wasm_path(&self) -> PathBuf

Where cargo build --release --target wasm32-unknown-unknown puts the cart wasm.

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

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.