[][src]Function nanogrep::run

pub fn run(config: Config) -> Result<(), Box<dyn Error>>

Runs the library logic. The functions expects a reference to a Config struct containing:

  • file: The file in which the search will be conducted
  • pattern: The pattern to search for in the contents of the file

If the execution runs without any problem, the function returns (). If not, a Box<std::error::Error> struct is returned.

Errors

The function returns errors on the following situations:

  • file doesn't exist
  • file could not be read (unauthorized read permission)