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: StringCrate name (also the wasm artifact name, with - mapped to _).
code: String§current: StringPath (relative to src/) of the file currently held in code.
assets: AssetsImplementations§
Source§impl Project
impl Project
Sourcepub fn create(dir: &Path, name: &str) -> Result<Self>
pub fn create(dir: &Path, name: &str) -> Result<Self>
Create a fresh project directory with template code and empty assets.
Sourcepub fn file_names(&self) -> Vec<String>
pub fn file_names(&self) -> Vec<String>
The *.rs files directly under src/, sorted with lib.rs first.
Sourcepub fn switch_to(&mut self, name: &str) -> Result<()>
pub fn switch_to(&mut self, name: &str) -> Result<()>
Persist nothing here; load src/<name> into code and make it current.
Sourcepub fn create_file(&mut self, name: &str) -> Result<String>
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.
Sourcepub fn lib_source(&self) -> String
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.
Auto Trait Implementations§
impl Freeze for Project
impl RefUnwindSafe for Project
impl Send for Project
impl Sync for Project
impl Unpin for Project
impl UnsafeUnpin for Project
impl UnwindSafe for Project
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more