Skip to main content

Files

Struct Files 

Source
pub struct Files<F: 'static = BTreeMap<String, String>> { /* private fields */ }
Expand description

A set of files, whose programs are written in the operations of registry: the Workspace its programs are run with, reading the programs they place and the files they import from it. A program read is checked against the operations (see Program::validate).

Each file is read once, and read again once it changes (Files::write), when its revision changes too.

Implementations§

Source§

impl<F: FileStore + 'static> Files<F>

Source

pub fn new(files: F, registry: Rc<OperationRegistry>) -> Rc<Self>

The files files, what they are made into kept in memory.

Source

pub fn with_cache( files: F, registry: Rc<OperationRegistry>, cache: Cache, ) -> Rc<Self>

The files files, what they are made into kept in cache.

Source

pub fn files(&self) -> Ref<'_, F>

The files, to read.

Source

pub fn registry(&self) -> &Rc<OperationRegistry>

The operations its programs are written in.

Source§

impl<F: FileStoreMut + 'static> Files<F>

Source

pub fn write(&self, path: &str, text: Option<String>) -> bool

Sets the file path to text, or — None — removes it, and forgets what was read from it (see Files). Says whether it changed anything: written as it was, nothing is forgotten.

Trait Implementations§

Source§

impl<F: FileStore + 'static> Workspace for Files<F>

Source§

fn program(&self, path: &str) -> GeopResult<Rc<Program>>

The program in the file at path, with the state it was saved with: the same each time it is asked for while the file does not change.
Source§

fn read(&self, path: &str) -> GeopResult<Rc<str>>

The text of the file at path: a STEP file a step imports. The same each time it is asked for while the file does not change.
Source§

fn list(&self) -> Vec<String>

Every file there is, by path.
Source§

fn resolve(&self, from: &str, name: &str) -> String

The path of the file the file at from names name.
Source§

fn relative(&self, from: &str, path: &str) -> String

How the file at from names the file at path.
Source§

fn revision(&self, path: &str) -> u64

The revision of the file at path: changes whenever the file does, so a node that read it is made again.
Source§

fn cache(&self) -> Option<&Cache>

What it keeps of what its files were made into, shared by every build reading them: none, for a workspace that keeps nothing, whose files are made into what they read as each time they are read.
Source§

fn digest(&self, path: &str) -> Option<u128>

A digest of the text of the file at path as it is now: what a node that read it was made from, in any process (see crate::kept). None for a file it does not have.

Auto Trait Implementations§

§

impl<F = BTreeMap<String, String>> !Freeze for Files<F>

§

impl<F = BTreeMap<String, String>> !RefUnwindSafe for Files<F>

§

impl<F = BTreeMap<String, String>> !Send for Files<F>

§

impl<F = BTreeMap<String, String>> !Sync for Files<F>

§

impl<F = BTreeMap<String, String>> !UnwindSafe for Files<F>

§

impl<F> Unpin for Files<F>
where F: Unpin,

§

impl<F> UnsafeUnpin for Files<F>
where F: UnsafeUnpin,

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.