memacc 0.1.11

Memory access functions.
Documentation
from datetime import datetime
from pathlib import Path
from string import Template

template_str = """\
impl IndexU$width for I<$value> {
    #[inline]
    #[must_use]
    fn value(self) -> usize {
        $value
    }
}"""
template = Template(template_str)

if __name__ == "__main__":
    path_output = Path(__file__).parent.parent / Path(
        "src/bitman/checked/index/generated.rs"
    )
    path_output = path_output.resolve()
    output = list()
    output.append(f"//! This file is automatically generated.")
    output.append(f"//!")
    output.append(f"""//! Date: {datetime.now().isoformat(timespec="seconds")}""")
    output.append(f"use crate::bitman::checked::index::IndexU8;")
    output.append(f"use crate::bitman::checked::index::IndexU32;")
    output.append(f"use crate::bitman::checked::index::I;")
    for i in range(8):
        output.append(template.substitute({"width": 8, "value": i}))
    for i in range(32):
        output.append(template.substitute({"width": 32, "value": i}))
    output_str = "\n".join(output)
    with path_output.open("w") as stream:
        stream.write(output_str)