-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reorg interpreter and adjust rustfmt (#287)
reorg interpreter crate - extract exit module from error module - move trap module into error module - add machine module - move memory and stack modules into machine module add more rustfmt configs ```toml imports_granularity="Crate" group_imports = "StdExternalCrate" ```
- Loading branch information
Showing
49 changed files
with
488 additions
and
355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
mod exit; | ||
mod trap; | ||
|
||
pub use self::{exit::*, trap::*}; | ||
|
||
/// Capture represents the result of execution. | ||
#[derive(Clone, Copy, Debug, Eq, PartialEq)] | ||
pub enum Capture<E, T> { | ||
/// The machine has exited. It cannot be executed again. | ||
Exit(E), | ||
/// The machine has trapped. It is waiting for external information, and can | ||
/// be executed again. | ||
Trap(T), | ||
} | ||
|
||
impl<E, T> Capture<E, T> { | ||
pub fn exit(self) -> Option<E> { | ||
match self { | ||
Self::Exit(e) => Some(e), | ||
Self::Trap(_) => None, | ||
} | ||
} | ||
|
||
pub fn trap(self) -> Option<T> { | ||
match self { | ||
Self::Exit(_) => None, | ||
Self::Trap(t) => Some(t), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.