Struct build_data::BuildData[][src]

pub struct BuildData {
    pub git_branch: Option<String>,
    pub git_commit: Option<String>,
    pub git_dirty: Option<bool>,
    pub hostname: Option<String>,
    pub rustc_version: Option<String>,
    pub time: String,
    pub time_seconds: u64,
}

Build data parser and holder. Example in module docs.

Fields

git_branch: Option<String>git_commit: Option<String>git_dirty: Option<bool>hostname: Option<String>rustc_version: Option<String>time: Stringtime_seconds: u64

Implementations

impl BuildData[src]

pub fn new(contents: impl AsRef<str>) -> Result<Self, &'static str>[src]

Parses build-data.txt written by build_data_writer::write.

See module docs for example and expected file format.

Ignores malformed fields.

Treats empty fields as missing.

Trims whitespace from field names and values.

If a field appears multiple times, uses the last value.

Errors

Returns an error when:

  • contents is empty
  • contents is missing TIME or TIME_SECONDS fields
  • contents has a TIME_SECONDS field that is not all decimal digits convertible to a u64

Trait Implementations

impl Debug for BuildData[src]

impl Display for BuildData[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.