pub struct ItemFact {
pub item: String,
pub pull: Option<PullFact>,
pub needs: Vec<u64>,
}Expand description
The facts of one item, for example issue-12.
use riff_core::wire::{ItemFact, PullFact, PullState, Waits};
let fact = |state| ItemFact {
item: "issue-12".into(),
pull: Some(PullFact { number: 40, state }),
needs: vec![],
};
assert_eq!(fact(PullState::Asked).waits("issue-12"), Some(Waits::Verify { pull: 40 }));
assert_eq!(fact(PullState::Passed).waits("issue-12"), Some(Waits::Merge { pull: 40 }));
assert_eq!(fact(PullState::Passed).waits("verify-issue-12"), Some(Waits::Merge { pull: 40 }));
assert_eq!(fact(PullState::Asked).waits("verify-issue-12"), None, "the verifier works");
assert_eq!(fact(PullState::Failed).waits("issue-12"), None);
assert_eq!(fact(PullState::Merged).waits("issue-12"), None);
let needs = ItemFact { item: "issue-12".into(), pull: None, needs: vec![9] };
assert_eq!(needs.waits("issue-12"), Some(Waits::Needs { issues: vec![9] }));
assert_eq!(needs.waits("verify-issue-12"), None);Fields§
§item: String§pull: Option<PullFact>The newest pull request of the item.
needs: Vec<u64>The open items of its Needs: line.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ItemFact
impl<'de> Deserialize<'de> for ItemFact
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
Source§impl JsonSchema for ItemFact
impl JsonSchema for ItemFact
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 moreimpl Eq for ItemFact
impl StructuralPartialEq for ItemFact
Auto Trait Implementations§
impl Freeze for ItemFact
impl RefUnwindSafe for ItemFact
impl Send for ItemFact
impl Sync for ItemFact
impl Unpin for ItemFact
impl UnsafeUnpin for ItemFact
impl UnwindSafe for ItemFact
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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.