aKode fase 5: rinomina interna (crate akode-*, akode-rs/, akode-cli/, binario akode, AKODE_*, ~/.akode, snapshot)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-11 11:06:46 +01:00
parent df99318392
commit 86e7c72e5f
10383 changed files with 749164 additions and 749170 deletions

View File

@@ -0,0 +1,22 @@
#[derive(Default)]
struct JsonByteCounter(usize);
impl std::io::Write for JsonByteCounter {
fn write(&mut self, bytes: &[u8]) -> std::io::Result<usize> {
self.0 = self.0.saturating_add(bytes.len());
Ok(bytes.len())
}
fn flush(&mut self) -> std::io::Result<()> {
Ok(())
}
}
/// Counts serialized JSON bytes without retaining the serialized output.
pub(crate) fn serialized_json_bytes<T: serde::Serialize + ?Sized>(
value: &T,
) -> serde_json::Result<usize> {
let mut counter = JsonByteCounter::default();
serde_json::to_writer(&mut counter, value)?;
Ok(counter.0)
}