pub struct EdgePolicy {
pub kind: &'static str,
pub forward: f64,
pub reverse: f64,
pub forward_reason: &'static str,
pub reverse_reason: &'static str,
}Expand description
Which way an edge is worth following, and what it means in each direction.
An edge of the composed graph has one kind and two readings, and the two are rarely
worth the same. From an issue, the milestone it belongs_to is strong context; from the
milestone, any one of its thirty-three issues is weak. So the weight is per direction,
and so is the reason — which is prose a reader of the answer sees, not a comment here.
A weight is a multiplier on the relevance of the entry the edge was followed from, so relevance decays with distance and the rate of decay is the edge’s own rather than a global constant.
use majordomus_cli::devcontext::{edge_policy, EdgePolicy};
// `belongs_to` is asymmetric, and the asymmetry is the point
let belongs_to: &EdgePolicy = edge_policy("belongs_to").unwrap();
assert!(
belongs_to.forward > belongs_to.reverse,
"an issue's milestone is context; a milestone's every issue is not",
);
assert_ne!(belongs_to.forward_reason, belongs_to.reverse_reason);
// `supersedes` is symmetric: either version is context for the other
let supersedes: &EdgePolicy = edge_policy("supersedes").unwrap();
assert_eq!(supersedes.forward, supersedes.reverse);
// and both readings of every followed kind carry words a reader of the answer sees
for kind in ["depends_on", "governed_by", "tested_by"] {
let e = edge_policy(kind).unwrap();
assert!(!e.forward_reason.is_empty() && !e.reverse_reason.is_empty(), "{kind}");
}Fields§
§kind: &'static strThe edge kind, as the composed graph names it.
forward: f64Relevance multiplier when followed from source to target; 0.0 to refuse.
reverse: f64Relevance multiplier when followed from target to source; 0.0 to refuse.
forward_reason: &'static strWhy the target is context for the source.
reverse_reason: &'static strWhy the source is context for the target.
Trait Implementations§
Source§impl Clone for EdgePolicy
impl Clone for EdgePolicy
Source§fn clone(&self) -> EdgePolicy
fn clone(&self) -> EdgePolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more