Expand description
Typed Rust interface to the nb note-taking CLI.
Handles notebook qualification, escaping, and output parsing.
Wraps the nb CLI as a subprocess, providing async methods for
all note-taking operations.
§Concurrency (0.3.0)
Notebook-scoped reads and Transaction::commit are serialized by a
process-shared, in-process gate registry keyed by the realpath of
the notebook Git common directory. Independently constructed NbClient
values that resolve to the same repository share one gate. Cross-process
index.lock wait is deferred.
Re-exports§
pub use fingerprint::Fingerprint;pub use fingerprint::fingerprint as compute_fingerprint;pub use parser::BodyFragments;pub use parser::DocumentKind;pub use parser::NoteDocument;pub use parser::ParseContext;pub use parser::SUPPORTED_DOCUMENT_EXTENSIONS;pub use parser::TagsIter;pub use parser::TagsStrIter;pub use parser::TodoState;pub use parser::parse;
Modules§
- fingerprint
- Fingerprint scheme for
NoteDocument. - parser
- Structural parser for
nbnotes, todos, and bookmarks.
Structs§
- Body
Fragment - One body fragment exposed by structured show.
- Commit
Outcome - Structured result of
crate::Transaction::commit. - Config
- Configuration for constructing an
NbClient. - IoError
- Serializable snapshot of a
std::io::Errorchain. - Line
Anchor - Versioned body-line authenticity token:
b3l1:<32 lowercase hex>. - LineRef
- Number + anchor reference to a body line.
- NbClient
- Client for invoking nb commands.
- Note
Line - One enumerated body line (line text without terminator).
- Note
Line Hit - One search hit within a body line.
- OpOutcome
- Outcome of one plan op after a successful commit.
- Search
Note Lines - Result of
search_note_lines. - Show
Note - Structured
show_noteresult. - Show
Note Lines - Windowed body-line listing with a document-level EOL declaration.
- Transaction
- In-memory plan bound to one notebook. Drop discards; no begin/rollback.
Enums§
- Boundary
At - Virtual body boundaries (
^/$). - IoError
Kind - Discriminator for the
std::io::ErrorKindtaxonomy, lifted into a serializable form. Marked#[non_exhaustive]so future versions can add new kinds without breaking downstreammatcharms that include a default branch. - Line
Edit - One line-oriented edit in an
edit_note_linesbatch. - LineEol
- Document-level end-of-line marker.
- Line
Position - Insert position relative to a line or body boundary.
- NbError
- Errors raised by
nb-apioperations. - Note
Target - Address an existing note by selector or notebook-relative path.
- Occurrence
- Substring occurrence selector.
- Parse
Error Kind - Narrow refusal contract for the structural parser.
- Search
Mode - Matching mode for
nb searchquery terms. - Task
Status - Status filter for
nb tasks.
Functions§
- derive_
git_ notebook_ name - Derive the notebook name from the current Git repository.
- git_
rev_ parse - Run
git rev-parsewith the given arguments and return the output as a path. - leaked_
git_ names - Returns the names of every environment variable in the current
process whose name starts with
GIT_. Exposed so other call sites (a futurestd::process::Commandvariant ingit_env, or any caller that wants the list without the scrub) share one enumeration policy. - scrub_
git_ env - Removes every environment variable whose name starts with
GIT_from the given tokioCommand’s environment. The spawned process inherits every other variable from the parent (PATH, HOME, LANG, …), just not the ones that redirect Git’s view of the repository. - scrub_
git_ env_ std - Synchronous-
Commandvariant ofscrub_git_env. nb-api usestokio::process::Commandfor everynbinvocation, butgit_rev_parse(the only directgitspawn) usesstd::process::Command. Both spawn sites must be scrubbed; if a future helper spawns git synchronously, use this overload.