Skip to main content

Crate trumly_fs

Crate trumly_fs 

Source
Expand description

The disk adapter: reads a model folder into (path, text) pairs for trumly-core. Kept apart from the core so the core never touches the filesystem.

Modules§

library
Where packs come from. Several places are searched and merged; the first place to have a pack’s name wins:
pack
Packs: folders of ordinary node files (planes, types, link types, rules) that can be added to a model.
telemetry
Anonymous usage data, off until the person says yes.

Functions§

apply_edit
Write the result of a core edit (trumly_core::ops) into a model folder: changed nodes go where their file already is (a renamed node stays in the same folder), and the files of deleted ids are removed. Returns (written, removed).
path_for_id
The relative path of the file holding node id, if there is one.
portable_id
The stricter rule for ids of files we create. A name that works on every system and cannot be mistaken for another: lower-case letters, digits, - and _; starts and ends with a letter or digit; at most 100 characters; not a name Windows reserves (con, nul, com1…); and no --, which only a pack’s nodes use as a namespace separator. Files that already exist keep whatever name they have, so older models still open and save.
read_model
Every .md file under dir at any depth, as (path relative to dir with /, text).
rev_of_text
A revision for a file’s text: it changes whenever the text does. Used so that a writer must have seen the current version of a node before it may replace it. FNV-1a, so the same text gives the same revision everywhere.
write_atomically
Write a file so that nobody ever reads half of it: write beside it, then rename over it.