pub struct Workspace {
pub root: Option<PathBuf>,
/* private fields */
}Expand description
The editor workspace — open documents and their IDs.
Fields§
§root: Option<PathBuf>Root directory for the workspace (e.g. the repo root).
Implementations§
Source§impl Workspace
impl Workspace
Sourcepub fn open(&mut self, doc: Document) -> DocumentId
pub fn open(&mut self, doc: Document) -> DocumentId
Opens a document and returns its ID.
Sourcepub fn get(&self, id: &DocumentId) -> Option<&Document>
pub fn get(&self, id: &DocumentId) -> Option<&Document>
Returns a reference to a document by ID.
Sourcepub fn get_mut(&mut self, id: &DocumentId) -> Option<&mut Document>
pub fn get_mut(&mut self, id: &DocumentId) -> Option<&mut Document>
Returns a mutable reference to a document by ID.
Sourcepub fn close(&mut self, id: &DocumentId) -> Option<Document>
pub fn close(&mut self, id: &DocumentId) -> Option<Document>
Closes a document, returning it if it was open.
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