memoryd (files, the check, edits, journal, index, recall, serving), the memory tools and built-in grants in brokerd, the memory block in loopd, bxctl reindex and memory, and the device checks with memoryd. Each task was built as a reference and gated. Each was replayed on its own at its end state (854 to 936 tests) and mutation-checked. Each skeleton compiles and fails its tests. Every todo comment was read beside its signature. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
35 lines
1.4 KiB
Rust
35 lines
1.4 KiB
Rust
//! The entries of `memory.md` and `user.md`: text separated by a line holding only `§` (M5a spec,
|
|
//! section 3). A file's size is the characters of its entries joined by separator lines, which
|
|
//! is what `render` writes, less the final newline.
|
|
|
|
use proto::memory::SEPARATOR;
|
|
|
|
/// The entries of a file's text: split at lines that are only `§` (spaces around it allowed),
|
|
/// each trimmed, empty ones left out.
|
|
pub fn parse(text: &str) -> Vec<String> {
|
|
// Walk `text.lines()`, collecting lines into `current`. A line whose trim() equals SEPARATOR
|
|
// ends an entry: `push(&mut entries, ¤t)`, then clear `current`. Any other line is pushed
|
|
// onto `current`. After the last line, `push` once more. Return `entries`.
|
|
todo!()
|
|
}
|
|
|
|
fn push(entries: &mut Vec<String>, lines: &[&str]) {
|
|
// Join `lines` with a newline, trim() the result, and push it (as a String) only when it is not
|
|
// empty.
|
|
todo!()
|
|
}
|
|
|
|
/// The entries joined by `\n§\n`, with a final newline; an empty list is an empty file.
|
|
pub fn render(entries: &[String]) -> String {
|
|
// An empty list is "". Otherwise the entries joined by format!("\n{SEPARATOR}\n"), with one
|
|
// newline added at the end.
|
|
todo!()
|
|
}
|
|
|
|
/// A file's size in characters, the one its limit is measured against.
|
|
pub fn size(entries: &[String]) -> usize {
|
|
// `render(entries)` without its final newline (`trim_end_matches('\n')`), counted in
|
|
// characters: chars().count().
|
|
todo!()
|
|
}
|