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

ReadOptions #114

Closed
OWissett opened this issue Aug 25, 2023 · 0 comments · Fixed by #120
Closed

ReadOptions #114

OWissett opened this issue Aug 25, 2023 · 0 comments · Fixed by #120
Milestone

Comments

@OWissett
Copy link
Collaborator

Trying to keep things a bit tidy, this issue is a feature request relating to #110 and #113

Here is the basics of the implementation:

#[derive(Debug, Default)]
pub struct ReadOptions {
    /// The format to read the file in.
    format: Format,
    /// The strictness level to use when reading the file.
    level: StrictnessLevel,
    /// Controls whether to capitalise the chains in the structure.
    capitalise_chains: bool,

}

impl ReadOptions {
    /// Constructs a new [`ReadOptions`] object with default values.
    pub fn new() -> Self {
        Self::default()
    }

    /// Sets the format to read the file in.
    pub fn format(&mut self, format: Format) {
        self.format = format;
    }

    /// Sets the strictness level to use when reading the file.
    pub fn level(&mut self, level: StrictnessLevel) {
        self.level = level;
    }

    /// Sets whether to capitalise the chains in the structure.
    pub fn capitalise_chains(&mut self, capitalise_chains: bool) {
        self.capitalise_chains = capitalise_chains;
    }
}

Essentially, it works in the same way as std::fs::OpenOptions

@douweschulte douweschulte linked a pull request Apr 16, 2024 that will close this issue
@OWissett OWissett added this to the v0.12.0 milestone May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant