pub struct Document {
pub buf: Buffer,
pub source: DocumentSource,
}Expand description
One document: the text buffer plus everything that used to live in parallel vectors keyed by buffer index (0014 wave 2). One struct, one arena — the alignment invariant is the type system now.
Fields§
§buf: Buffer§source: DocumentSourceWhat backs this document (0021 §4): the surface payload lives in the source variant; readonly derives from it at construction.
Implementations§
Source§impl Document
impl Document
pub fn remote(buffer: Buffer, source: RemoteDocument) -> Self
pub fn directory(buffer: Buffer, source: RemoteDirectory) -> Self
pub fn remote_metadata(&self) -> Option<&RemoteDocument>
pub fn directory_metadata_ref(&self) -> Option<&RemoteDirectory>
Source§impl Document
impl Document
pub fn new(buf: Buffer) -> Self
Sourcepub fn surface(buf: Buffer, surface: Surface, context: GitContext) -> Self
pub fn surface(buf: Buffer, surface: Surface, context: GitContext) -> Self
A git-memory surface: job-owned content, readonly derived from the source — not set by hand (0021 §4).
Sourcepub fn output(buf: Buffer) -> Self
pub fn output(buf: Buffer) -> Self
Named virtual content (:!cmd output, help, the undo browser):
readonly derived from the source.
Sourcepub fn container_file(
buf: Buffer,
container: ContainerId,
path: PathBuf,
) -> Self
pub fn container_file( buf: Buffer, container: ContainerId, path: PathBuf, ) -> Self
A file read from a container (0037 DC1a/b): readonly derived from the source; the path names container bytes, never a local file.
Sourcepub fn syntax_path(&self) -> Option<&Path>
pub fn syntax_path(&self) -> Option<&Path>
Syntax identity is data; parsers live on the display-analysis worker.
pub fn matches_target(&self, target: &FileTarget) -> bool
Sourcepub fn surface_payload(&self) -> Option<&Surface>
pub fn surface_payload(&self) -> Option<&Surface>
The surface payload, when this document is one.
Sourcepub fn surface_payload_mut(&mut self) -> Option<&mut Surface>
pub fn surface_payload_mut(&mut self) -> Option<&mut Surface>
Mutable surface payload, when this document is one.