pub fn pad_lines(pdb_f: &str) -> BufReader<Cursor<Vec<u8>>>Expand description
Reads a text file specified by pdb_f, pads each line that starts with ATOM to 80 characters
with spaces, and returns a buffered reader over an in-memory buffer
containing the padded content.
§Arguments
pdb_f- A string slice that holds the path to the input text file.
§Returns
A BufReader wrapped around a Cursor<Vec<u8>>>, where each line from
the input file is padded to 80 characters with spaces and newline character.
§Panics
This function panics if it encounters any I/O errors while reading or processing the file.
§Examples
use pdb_handler::pad_lines;
use std::io::Read;
use std::io::BufReader;
let mut padded_reader = pad_lines("example-pdbs/dna.pdb");
let mut buffer = String::new();
padded_reader.read_to_string(&mut buffer).unwrap();
println!("Padded content:\n{}", buffer);This example reads lines from “dna.pdb”, pads each line that starts with ATOM with spaces
to reach 80 characters, and then prints out the padded content.