Mentions légales du service

Skip to content
Snippets Groups Projects
Commit b90ed716 authored by Philippe Noel's avatar Philippe Noel
Browse files

add documentation in residue

parent bb1742c6
Branches
Tags
No related merge requests found
......@@ -8,6 +8,17 @@ pub struct Residue {
}
impl Residue {
/// Create a new Residue structure with an empty list of atom.
/// The Residue have a name and a number
///
/// # Examples
///
/// ````
/// use pdbparser;
///
/// let lys = pdbparser::Residue::new(String::from("lysine"), 1);
///
/// ````
pub fn new(name: String, res_num: u64) -> Residue {
Residue {
name,
......@@ -16,16 +27,43 @@ impl Residue {
}
}
/// Get the number of the residue
pub fn get_res_num(&self) -> u64 {
self.res_num
}
/// Get the number of Atom in the Residue
///
/// # Examples
///
/// ````
/// use pdbparser;
///
/// let lys = pdbparser::Residue::new(String::from("lysine"), 1);
/// assert_eq!(0, lys.get_number_atom());
///
/// ````
pub fn get_number_atom(&self) -> u64 {
self.lst_atom.len() as u64
}
pub fn add_atom(&mut self, atom_name: String, atom_number: u64, coord: [f32; 3]) {
self.lst_atom.push(Atom::new(atom_name, atom_number, coord));
/// Add an Atom structure to the Residue
///
/// # Examples
///
/// ````
/// use pdbparser;
///
/// let mut lys = pdbparser::Residue::new(String::from("lysine"), 1);
/// let carbon = pdbparser::Atom::new(String::from("HT1"), 1, [0.0, 0.0, 0.0]);
///
/// lys.add_atom(carbon);
///
/// assert_eq!(1, lys.get_number_atom());
///
/// ````
pub fn add_atom(&mut self, a: Atom) {
self.lst_atom.push(a);
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment