pub struct Seen(/* private fields */);Expand description
The hash (content_hash) of each file’s text as Read last showed
it or Edit or Write last left it, by
resolved path; shared by its clones. With it, an edit whose old_text
is not found says whether the file changed since, and so needs reading
again.
It also keeps the whole text of the files last seen whole, up to 8 MB
of them, so an edit starts from it and only writes, if the file still
holds that text (Workspace::write_if).
Implementations§
Source§impl Seen
impl Seen
Sourcepub fn saw(&self, path: &Path, hash: ContentHash)
pub fn saw(&self, path: &Path, hash: ContentHash)
Notes that the file path held the text with hash.
Sourcepub fn saw_whole(&self, path: &Path, text: &str)
pub fn saw_whole(&self, path: &Path, text: &str)
Notes that the file path held text, all of it: its hash, and the
text itself, which a text seen longer ago may make room for.
Sourcepub fn forget(&self, path: &Path)
pub fn forget(&self, path: &Path)
Forgets what path held, as after a write of it that may or may
not have happened, so the next edit starts from the file itself.
Sourcepub fn hash(&self, path: &Path) -> Option<ContentHash>
pub fn hash(&self, path: &Path) -> Option<ContentHash>
The hash of the text path last held when it was seen, if it was.