pub struct BuildIdentity {
pub commit: String,
pub dirty: bool,
pub source_version: Option<String>,
pub source_hash: Option<String>,
}Expand description
The build identity a deployment serves, as far as this module relies on it. Other fields of the served document are ignored rather than refused: the document is written by another program, and a field it adds is not a malformation.
use majordomus_cli::served::BuildIdentity;
let id = BuildIdentity {
commit: "a".repeat(40),
dirty: false,
source_version: Some("0.7.0".into()),
source_hash: None,
};
// what is judged is the commit and whether the tree it was built from was committed
assert_eq!(id.commit.len(), 40);
assert!(!id.dirty);Fields§
§commit: StringThe full commit the served build was made from.
dirty: boolWhether the tree it was built from had uncommitted changes. A dirty build names a commit it does not equal, so it proves no commit.
source_version: Option<String>The version the build states, when it states one.
source_hash: Option<String>The fingerprint of the site’s canonical inputs, when the build states one.
Implementations§
Source§impl BuildIdentity
impl BuildIdentity
Sourcepub fn parse(body: &[u8]) -> Result<BuildIdentity, Malformed>
pub fn parse(body: &[u8]) -> Result<BuildIdentity, Malformed>
Reads a served body. The commit must be a full forty-character sha: a prefix names whatever happens to start with it, and a served identity that could mean several commits proves none of them.
use majordomus_cli::served::BuildIdentity;
let body = format!(r#"{{"schema":1,"commit":"{}","dirty":false}}"#, "a".repeat(40));
assert_eq!(BuildIdentity::parse(body.as_bytes()).unwrap().commit, "a".repeat(40));
assert!(BuildIdentity::parse(b"<html>").is_err());Trait Implementations§
Source§impl Clone for BuildIdentity
impl Clone for BuildIdentity
Source§fn clone(&self) -> BuildIdentity
fn clone(&self) -> BuildIdentity
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BuildIdentity
impl Debug for BuildIdentity
Source§impl<'de> Deserialize<'de> for BuildIdentity
impl<'de> Deserialize<'de> for BuildIdentity
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for BuildIdentity
Source§impl JsonSchema for BuildIdentity
impl JsonSchema for BuildIdentity
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for BuildIdentity
impl PartialEq for BuildIdentity
Source§fn eq(&self, other: &BuildIdentity) -> bool
fn eq(&self, other: &BuildIdentity) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for BuildIdentity
impl Serialize for BuildIdentity
impl StructuralPartialEq for BuildIdentity
Auto Trait Implementations§
impl Freeze for BuildIdentity
impl RefUnwindSafe for BuildIdentity
impl Send for BuildIdentity
impl Sync for BuildIdentity
impl Unpin for BuildIdentity
impl UnsafeUnpin for BuildIdentity
impl UnwindSafe for BuildIdentity
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.