pub enum Doc {
Show 16 variants
Json(JsonAdapter),
Csv(CsvAdapter),
Xml(XmlAdapter),
Html(HtmlAdapter),
Text(TextModel),
Sqlite(SqliteAdapter),
Fs(FsAdapter),
FsDeep(ComposeAdapter<FsAdapter>),
Git(GitAdapter),
Archive(ComposeAdapter<ArchiveAdapter>),
ArchiveRaw(ArchiveAdapter),
Xlsx(XlsxAdapter),
Syntax(TreeSitterAdapter),
Code(CodeModel),
Mount(MountAdapter),
Boxed(Dyn, Box<dyn Fn(NodeId) -> String>),
}Expand description
A materialized source: one variant per adapter family. JSON-model formats (json/yaml/toml) render node results as pointers, the rest as locators.
Variants§
Json(JsonAdapter)
Csv(CsvAdapter)
Xml(XmlAdapter)
Html(HtmlAdapter)
Text(TextModel)
Sqlite(SqliteAdapter)
Fs(FsAdapter)
FsDeep(ComposeAdapter<FsAdapter>)
Git(GitAdapter)
Archive(ComposeAdapter<ArchiveAdapter>)
ArchiveRaw(ArchiveAdapter)
An archive held opaque (no_graft): the member tree with
leaves as plain entries — the tar -t view.
Xlsx(XlsxAdapter)
Syntax(TreeSitterAdapter)
Code(CodeModel)
Mount(MountAdapter)
Boxed(Dyn, Box<dyn Fn(NodeId) -> String>)
Any adapter behind the object-safe trait, with its locator
renderer — the carrier for scheme targets opened through
qua’s dispatch (gcl:, kafka:, neo4j://, …).
Implementations§
Source§impl Doc
impl Doc
Sourcepub fn parse(input: &str, format: &str) -> Result<Doc>
pub fn parse(input: &str, format: &str) -> Result<Doc>
Parse a text document by format name — the wasm entry point,
and the text tail of the native open. Formats: json, yaml,
toml, csv, tsv, xml, html, markdown, jsonl/ndjson, kaiv/daiv.
Sourcepub fn export(
&self,
query: &str,
now: (i64, u32),
allow_shell: bool,
kind: &str,
) -> Result<String>
pub fn export( &self, query: &str, now: (i64, u32), allow_shell: bool, kind: &str, ) -> Result<String>
Run query and render its results as exportable markup:
md/markdown, html, or txt/text. Node results render
structurally through the text vocabulary — sections back to
headings, lists to lists — and kinds outside it degrade to
prose paragraphs; value results render as lines.
Sourcepub fn run_modeled(
&self,
query: &str,
now: (i64, u32),
allow_shell: bool,
model: &Model,
) -> Result<QueryResult>
pub fn run_modeled( &self, query: &str, now: (i64, u32), allow_shell: bool, model: &Model, ) -> Result<QueryResult>
Run against a --model-enriched view of this source: the
derived containers, references, and edges the model declares,
over this Doc’s base. now binds now() for the base and
its constructor queries alike.
Sourcepub fn render_modeled(&self, node: NodeId, model: &Model) -> String
pub fn render_modeled(&self, node: NodeId, model: &Model) -> String
Render a node from a model-enriched run: /container/value
for derived nodes, the base’s own renderer otherwise.
pub fn run( &self, query: &str, now: (i64, u32), allow_shell: bool, ) -> Result<QueryResult>
Sourcepub fn render(&self, node: NodeId) -> String
pub fn render(&self, node: NodeId) -> String
Render a node result as its source-appropriate locator.
Sourcepub fn sqlite_bytes(bytes: &[u8]) -> Result<Doc>
pub fn sqlite_bytes(bytes: &[u8]) -> Result<Doc>
Open a SQLite database from its file bytes — a .db that
never touched a filesystem (the browser’s uploaded files).
Sourcepub fn mount_docs(parts: Vec<(String, Doc)>) -> Result<Doc>
pub fn mount_docs(parts: Vec<(String, Doc)>) -> Result<Doc>
Mount already-built documents as named children of one root —
the general wasm-safe mount, for callers that assembled their
Docs from text or bytes rather than paths.
Sourcepub fn attach_url(&mut self, url: &str)
pub fn attach_url(&mut self, url: &str)
Declare a source’s own URL on its adapter — today the html
DOM reading, whose relative hrefs join against it for the
acquisition arrow (::href--> across documents). Other
formats ignore it (their cross-references carry no URL yet).
Sourcepub fn url_roots(&self, urls: &[(String, String)]) -> HashMap<String, NodeId>
pub fn url_roots(&self, urls: &[(String, String)]) -> HashMap<String, NodeId>
The reference targets for this doc: external-reference
identifier (its declared URL) → the root the arrow lands
on, for every mounted source that declared one. urls is
(mount name, url); on a single-source (path-bare) doc the
one root answers.
Sourcepub fn mount_texts(parts: &[(String, String, String)]) -> Result<Doc>
pub fn mount_texts(parts: &[(String, String, String)]) -> Result<Doc>
Mount several already-parsed text documents as named children
of one root — Doc::mount_docs over Doc::parse, for
callers that hold text (the browser playground’s paste
boxes). parts is (name, format, text).
Source§impl Doc
impl Doc
Sourcepub fn open(path: &Path, opts: &Options) -> Result<Doc>
pub fn open(path: &Path, opts: &Options) -> Result<Doc>
Open one path as a local source. Directories are filesystem
trees (--graft grafts parseable leaves); git:PATH opens a
repository; binary kinds (SQLite, spreadsheets, archives) and
source files dispatch by extension/magic; everything else is a
text document parsed by extension or content sniff.
Sourcepub fn mount(paths: &[PathBuf], opts: &Options) -> Result<Doc>
pub fn mount(paths: &[PathBuf], opts: &Options) -> Result<Doc>
Open several sources as named children of one root (file stem =
mount name), so a single query — including a <=> join — spans
them all.
Sourcepub fn mount_specs(specs: &[MountSpec], opts: &Options) -> Result<Doc>
pub fn mount_specs(specs: &[MountSpec], opts: &Options) -> Result<Doc>
Doc::mount with optional explicit mount names
(NAME=TARGET); an unnamed spec mounts under its file stem.
Auto Trait Implementations§
impl !Freeze for Doc
impl !RefUnwindSafe for Doc
impl !Send for Doc
impl !Sync for Doc
impl !UnwindSafe for Doc
impl Unpin for Doc
impl UnsafeUnpin for Doc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more