mirbuilder: integrate Normalizer (toggle), add tag-quiet mode, share f64 canonicalization; expand canaries; doc updates for quick timeout + dev toggles; Phase 21.5 optimization readiness

This commit is contained in:
nyash-codex
2025-11-10 23:17:46 +09:00
parent 24d88a10c0
commit ece91306b7
56 changed files with 2227 additions and 142 deletions

View File

@ -1,50 +1,4 @@
//! Core readonly File I/O provider (ring1).
//! Provides basic read-only file operations using std::fs::File.
use super::provider::{FileCaps, FileError, FileIo, FileResult, normalize_newlines};
use std::fs::File;
use std::io::Read;
use std::sync::RwLock;
pub struct CoreRoFileIo {
handle: RwLock<Option<File>>,
}
impl CoreRoFileIo {
pub fn new() -> Self {
Self {
handle: RwLock::new(None),
}
}
}
impl FileIo for CoreRoFileIo {
fn caps(&self) -> FileCaps {
FileCaps::read_only()
}
fn open(&self, path: &str) -> FileResult<()> {
let file = File::open(path)
.map_err(|e| FileError::Io(format!("Failed to open {}: {}", path, e)))?;
*self.handle.write().unwrap() = Some(file);
Ok(())
}
fn read(&self) -> FileResult<String> {
let mut handle = self.handle.write().unwrap();
if let Some(ref mut file) = *handle {
let mut content = String::new();
file.read_to_string(&mut content)
.map_err(|e| FileError::Io(format!("Read failed: {}", e)))?;
Ok(normalize_newlines(&content))
} else {
Err(FileError::Io("No file opened".to_string()))
}
}
fn close(&self) -> FileResult<()> {
*self.handle.write().unwrap() = None;
Ok(())
}
}
//! Core readonly File I/O provider (ring1) — moved under `src/providers/ring1/file/core_ro.rs`.
//! This module re-exports the ring1 implementation to keep legacy paths working.
pub use crate::providers::ring1::file::core_ro::CoreRoFileIo;