Struct Rob

Source
pub struct Rob {
    pub cfg: Config,
    /* private fields */
}
Expand description

The main Rob structure.

Fields§

§cfg: Config

Implementations§

Source§

impl Rob

Source

pub const MAX_DIR_LVL: usize = 4usize

Source

pub fn new() -> Rob

Source

pub fn needs_rebuild(bin: &str, src: &str) -> IoResult<bool>

Checks if src file needs rebuild

Source

pub fn needs_rebuild_many(bin: &str, srcs: &Vec<String>) -> RobResult<bool>

Source

pub fn go_rebuild_yourself(source_path: &str) -> IoResult<()>

Modified text from: https://github.com/tsoding/nobuild Go Rebuild Urself™ Technology

How to use it:

fn main() {
    go_rebuild_yourself!();
    // actual work
}

After your added this macro every time you run ./rob it will detect that you modified its original source code and will try to rebuild itself before doing any actual work. So you only need to bootstrap your build system once.

The modification is detected by comparing the last modified times of the executable and its source code. The same way the make utility usually does it.

Source

pub fn get_last_modification_time<P>(p: P) -> IoResult<SystemTime>
where P: AsRef<Path>,

Source

pub fn noext(p: &str) -> String

Takes path and returns it without the file extension

Source

pub fn is_file<P>(p: P) -> bool
where P: Into<PathBuf>,

Source

pub fn is_dir<P>(p: P) -> bool
where P: Into<PathBuf>,

Source

pub fn path_exists<P>(p: P) -> bool
where P: Into<PathBuf>,

Source

pub fn rename<P>(from: P, to: P) -> IoResult<()>
where P: AsRef<Path>,

Source

pub fn mkdir<P>(p: P) -> IoResult<()>
where P: Into<PathBuf>,

Source

pub fn rm_if_exists<P>(p: P)
where P: Into<PathBuf> + ToOwned<Owned = String>,

Source

pub fn rm<P>(p: P) -> IoResult<()>
where P: Into<PathBuf> + ToOwned<Owned = String>,

Source

pub fn log(lvl: LogLevel, out: &str)

Source

pub fn echo(&mut self, echo: bool) -> &mut Self

Source

pub fn keepgoing(&mut self, keepgoing: bool) -> &mut Self

Source

pub fn append<S>(&mut self, xs: &[S]) -> &mut Self
where S: ToString + PartialEq<&'static str>,

Source

pub fn append_mv<S>(&mut self, xs: &[S]) -> &mut Self
where S: ToString + PartialEq<&'static str>,

Source

pub fn execute_jobs_sync(&mut self) -> RobResult<Vec<Vec<Output>>>

Source

pub fn execute_jobs_async(&mut self) -> RobResult<Vec<Vec<Output>>>

Source

pub fn append_job_job(&mut self, job: Job) -> &mut Self

Source

pub fn append_job<S>( &mut self, target: &str, deps: Vec<S>, cmd: RobCommand, ) -> &mut Self
where S: Into<String>,

Source

pub fn execute(&mut self) -> IoResult<&mut Self>

Source

pub fn execute_sync(&mut self) -> IoResult<Output>

Source

pub fn execute_all_sync(&mut self) -> RobResult<Vec<Output>>

Source

pub fn output(&mut self) -> Option<Output>

Source

pub fn outputs_refs(&self) -> VecDeque<&Output>

Source

pub fn outputs(self) -> VecDeque<Output>

Trait Implementations§

Source§

impl Clone for Rob

Source§

fn clone(&self) -> Rob

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Rob

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Rob

Source§

fn default() -> Rob

Returns the “default value” for a type. Read more
Source§

impl Hash for Rob

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Rob

Source§

fn eq(&self, other: &Rob) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Rob

Source§

impl StructuralPartialEq for Rob

Auto Trait Implementations§

§

impl Freeze for Rob

§

impl RefUnwindSafe for Rob

§

impl Send for Rob

§

impl Sync for Rob

§

impl Unpin for Rob

§

impl UnwindSafe for Rob

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.