Skip to content

Commit

Permalink
refactor: rename SourceReader to SourceRead
Browse files Browse the repository at this point in the history
consistent with `Read` trait from `std`
  • Loading branch information
dxrcy committed Dec 19, 2024
1 parent ae0434b commit 2f4eb21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/debugger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod parse;
mod source;

use self::command::{Command, Label, Location, MemoryLocation};
use self::source::{Source, SourceReader};
use self::source::{Source, SourceRead};
use crate::air::AsmLine;
use crate::dprintln;
use crate::output::{Condition, Output};
Expand Down
12 changes: 6 additions & 6 deletions src/debugger/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn echo_command(command: Option<&str>) {
}

/// A trait for objects which can yield a command, by iterating a string or reading a file.
pub trait SourceReader {
pub trait SourceRead {
/// `None` indicates EOF.
/// Returned string slice MAY include leading or trailing whitespace.
fn read(&mut self) -> Option<&str>;
Expand All @@ -92,7 +92,7 @@ impl Source {
}
}

impl SourceReader for Source {
impl SourceRead for Source {
fn read(&mut self) -> Option<&str> {
// Always try to read from argument first
// If argument is `None`, or if read from argument returns `None`, then read from stream
Expand All @@ -117,7 +117,7 @@ impl Stream {
}
}

impl SourceReader for Stream {
impl SourceRead for Stream {
fn read(&mut self) -> Option<&str> {
match self {
Self::Stdin(stdin) => {
Expand All @@ -140,7 +140,7 @@ impl Argument {
}
}

impl SourceReader for Argument {
impl SourceRead for Argument {
fn read(&mut self) -> Option<&str> {
// EOF
if self.cursor >= self.buffer.len() {
Expand Down Expand Up @@ -183,7 +183,7 @@ impl Stdin {
}
}

impl SourceReader for Stdin {
impl SourceRead for Stdin {
fn read(&mut self) -> Option<&str> {
self.buffer.clear();

Expand Down Expand Up @@ -413,7 +413,7 @@ impl Terminal {
}
}

impl SourceReader for Terminal {
impl SourceRead for Terminal {
fn read(&mut self) -> Option<&str> {
// Reached end of line buffer: read new line
if self.cursor == 0 {
Expand Down

0 comments on commit 2f4eb21

Please sign in to comment.