Struct cronrunner::crontab::reader::Reader
source · pub struct Reader;Expand description
Read current user’s crontab.
Reader only provides the read() function
that outputs a String or a ReadError.
The String result can be fed to
Parser::parse() for lexing and parsing.
Implementations§
source§impl Reader
impl Reader
sourcepub fn read() -> Result<String, ReadError>
pub fn read() -> Result<String, ReadError>
Read current user’s crontab to a String.
§Examples
use cronrunner::crontab::Reader;
let crontab: String = match Reader::read() {
Ok(crontab) => crontab, // Output of `crontab -l` as string.
Err(_) => return (),
};§Errors
Will return Err(ReadError) if the crontab cannot
be read. This can happen when:
- The
crontab -lcommand returns with a non-zero exit code or no exit code at all (process terminated). - The
crontabcommand fails (e.g., executable not found).
Auto Trait Implementations§
impl Freeze for Reader
impl RefUnwindSafe for Reader
impl Send for Reader
impl Sync for Reader
impl Unpin for Reader
impl UnwindSafe for Reader
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more