Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge feat/confloader to dev/0.0.1 #9

Merged
merged 46 commits into from
Jun 19, 2024
Merged

merge feat/confloader to dev/0.0.1 #9

merged 46 commits into from
Jun 19, 2024

Conversation

Esgr0bar
Copy link
Contributor

No description provided.

@Esgr0bar Esgr0bar added ready for review feature or request is ready for review ready for merge feature or request has been reviewed and is ready to merge labels May 24, 2024
@Esgr0bar
Copy link
Contributor Author

Esgr0bar commented May 27, 2024

improvement by using 'anyhow' instead of 'Box dyn Error' :

fn load_config(file_path: &str) -> Result<MachineConfig> {
    let config_str = fs::read_to_string(file_path)
        .with_context(|| format!("Failed to read configuration file: {}", file_path))?;
    let config: MachineConfig = match file_path.rsplit('.').next().ok_or_else(|| anyhow::anyhow!("No file extension found"))? {
        "toml" => toml::from_str(&config_str)
            .with_context(|| format!("Failed to parse TOML configuration file: {}", file_path))?,
        _ => return Err(anyhow::anyhow!("Unsupported file format: {}", file_path)),
    };
    Ok(config)
} 

@shard77 shard77 self-requested a review May 28, 2024 07:58
@shard77
Copy link
Member

shard77 commented May 28, 2024

improvement by using 'anyhow' instead of 'Box dyn Error' :

fn load_config(file_path: &str) -> Result<MachineConfig> {
    let config_str = fs::read_to_string(file_path)
        .with_context(|| format!("Failed to read configuration file: {}", file_path))?;
    let config: MachineConfig = match file_path.rsplit('.').next().ok_or_else(|| anyhow::anyhow!("No file extension found"))? {
        "toml" => toml::from_str(&config_str)
            .with_context(|| format!("Failed to parse TOML configuration file: {}", file_path))?,
        _ => return Err(anyhow::anyhow!("Unsupported file format: {}", file_path)),
    };
    Ok(config)
} 

@Esgr0bar can you add anyhow::Error in the Result? And you can use anyhow::Context instead of the macro anyhow::anyhow!

Cargo.toml Outdated Show resolved Hide resolved
src/configuration.rs Outdated Show resolved Hide resolved
src/configuration.rs Outdated Show resolved Hide resolved
src/configuration.rs Outdated Show resolved Hide resolved
src/configuration.rs Outdated Show resolved Hide resolved
src/configuration.rs Outdated Show resolved Hide resolved
tests/test.json Outdated Show resolved Hide resolved
src/configuration.rs Outdated Show resolved Hide resolved
src/configuration.rs Outdated Show resolved Hide resolved
src/utils/configuration.rs Fixed Show fixed Hide fixed
src/utils/configuration.rs Fixed Show fixed Hide fixed
src/utils/configuration.rs Fixed Show fixed Hide fixed
src/utils/configuration.rs Fixed Show fixed Hide fixed
@standard3 standard3 added enhancement New feature or request and removed ready for merge feature or request has been reviewed and is ready to merge labels Jun 18, 2024
src/configuration.rs Fixed Show resolved Hide resolved
src/configuration.rs Fixed Show resolved Hide resolved
@Esgr0bar Esgr0bar linked an issue Jun 19, 2024 that may be closed by this pull request
Copy link
Member

@shard77 shard77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - nothing to add here as of right now

src/configuration.rs Outdated Show resolved Hide resolved
src/configuration.rs Outdated Show resolved Hide resolved
src/configuration.rs Outdated Show resolved Hide resolved
src/configuration.rs Outdated Show resolved Hide resolved
src/configuration.rs Outdated Show resolved Hide resolved
@standard3 standard3 added the ready for merge feature or request has been reviewed and is ready to merge label Jun 19, 2024
@standard3 standard3 added this to the v0.1.0 milestone Jun 19, 2024
@standard3 standard3 merged commit 38efd7d into dev/0.1.0 Jun 19, 2024
3 checks passed
@standard3 standard3 deleted the feat/confloader branch June 19, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready for merge feature or request has been reviewed and is ready to merge ready for review feature or request is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Basic generic structures (CPU, MMU modes, Page Table Entries, ...)
3 participants