diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-08-27 07:20:54 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-08-27 07:20:54 +0200 |
| commit | 698f12a7b4cf403a53e98d5bd3f7318e107079f9 (patch) | |
| tree | b6f8fbad60d888d6a660036ab8ccacf3efa9d3c7 /lib | |
| parent | 50ebac34fec99c853b2f010bfd100c11b5e0a603 (diff) | |
| download | tools.nes-698f12a7b4cf403a53e98d5bd3f7318e107079f9.tar.gz tools.nes-698f12a7b4cf403a53e98d5bd3f7318e107079f9.zip | |
Change the first argument of Machine::from() into a &Path
This makes for a saner API, and some users (e.g. vnf-tests) don't have
to go over backwards to provide a parameter they already had as a
PathBuf.
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/vnf/src/lib.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/vnf/src/lib.rs b/lib/vnf/src/lib.rs index e9c7539..b4e2399 100644 --- a/lib/vnf/src/lib.rs +++ b/lib/vnf/src/lib.rs @@ -4,6 +4,7 @@ use std::collections::HashMap; use std::fs::File; use std::io::{ErrorKind, Read}; use std::ops::Range; +use std::path::Path; use xixanta::opcodes::AddressingMode; use xixanta::opcodes::{Instruction, InstructionIdentifier, OPCODES}; @@ -337,9 +338,12 @@ impl Machine { /// Initialize a Machine object by reading the ROM file located at /// 'file'. The machine should be initialized to start from the 'start' /// address, and the memory should be initialized with the given 'policy'. - pub fn from(file: &String, start: u16, policy: MemoryPolicy) -> Result<Self, String> { + pub fn from(file: &Path, start: u16, policy: MemoryPolicy) -> Result<Self, String> { let Ok(mut input) = File::open(file) else { - return Err(format!("failed to open the given file '{}'", file)); + return Err(format!( + "failed to open the given file '{}'", + file.display() + )); }; // Read the header in order to detect the PRG ROM size. |
