pub struct Workspace {
pub config: WorkspaceConfig,
pub assets: Vec<AssetEntry>,
pub dirty: bool,
}Fields§
§config: WorkspaceConfig§assets: Vec<AssetEntry>§dirty: boolImplementations§
Source§impl Workspace
impl Workspace
pub fn new(name: &str) -> Self
Sourcepub fn add_asset(
&mut self,
path: &str,
kind: &str,
hash: &str,
size_bytes: usize,
)
pub fn add_asset( &mut self, path: &str, kind: &str, hash: &str, size_bytes: usize, )
Add or update an asset. Sets dirty = true.
Sourcepub fn remove_asset(&mut self, path: &str) -> bool
pub fn remove_asset(&mut self, path: &str) -> bool
Remove an asset. Returns true if it was found and removed.
Sourcepub fn find_asset(&self, path: &str) -> Option<&AssetEntry>
pub fn find_asset(&self, path: &str) -> Option<&AssetEntry>
Find an asset by path.
Sourcepub fn assets_by_kind(&self, kind: &str) -> Vec<&AssetEntry>
pub fn assets_by_kind(&self, kind: &str) -> Vec<&AssetEntry>
All assets of a given kind.
Sourcepub fn total_size(&self) -> usize
pub fn total_size(&self) -> usize
Sum of all asset sizes.
Sourcepub fn asset_count(&self) -> usize
pub fn asset_count(&self) -> usize
Number of assets.
Sourcepub fn from_json(s: &str) -> Result<Workspace, String>
pub fn from_json(s: &str) -> Result<Workspace, String>
Deserialize workspace from JSON (best-effort).
Sourcepub fn mark_clean(&mut self)
pub fn mark_clean(&mut self)
Mark workspace as clean (dirty = false).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Workspace
impl RefUnwindSafe for Workspace
impl Send for Workspace
impl Sync for Workspace
impl Unpin for Workspace
impl UnsafeUnpin for Workspace
impl UnwindSafe for Workspace
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