Skip to main content

Folder

Struct Folder 

Source
pub struct Folder { /* private fields */ }
Expand description

The folder edited: the files under it of the extensions the explorer shows — programs, and the data files operations read (see OperationInfo::reads).

Implementations§

Source§

impl Folder

Source

pub fn new(root: &Path, extensions: Vec<String>) -> GeopResult<Self>

Source

pub fn root(&self) -> &Path

The folder, canonical.

Source

pub fn names_file(&self, path: &str) -> bool

Whether path — relative, /-separated — can name a file of the folder: no empty, . or .. segment, nothing a platform reads as a root, a drive or a stream (/, \, :), and an extension shown.

Source

pub fn file(&self, path: &str) -> GeopResult<PathBuf>

The file path names under the folder — checked, before it is read or written, to stay in it: where it is already, its own canonical path; where it is not yet, that of the nearest folder above it that is. A link out of the folder is refused like ...

Source

pub fn files(&self) -> GeopResult<BTreeMap<String, String>>

Every file of the folder, by path, its content as a workspace holds it: its text, or a data: URL of bytes that are not (see geop_core_program::workspace::content). Hidden folders, node_modules and target are left out, and so is a link out of the folder.

Source

pub fn write(&self, path: &str, content: &str) -> GeopResult<()>

Write the file path, its content content as a workspace holds it (see Folder::files): its bytes, the decoded ones of a data: URL. Written whole, then put in place: a reader meanwhile sees the old file or the new, never half of one.

Source

pub fn remove(&self, path: &str) -> GeopResult<()>

Remove the file path; one already gone is no error.

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> 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, 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.