douweschulte / pdbtbx

A library to open/edit/save (crystallographic) Protein Data Bank (PDB) and mmCIF files in Rust.

Home Page:https://crates.io/crates/pdbtbx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReadOptions

OWissett opened this issue · comments

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