pub struct Edge {
pub kind: EdgeKind,
pub file: Option<String>,
pub line: Option<u32>,
pub confidence: f32,
}Expand description
An edge in the code graph with location info.
Fields§
§kind: EdgeKindThe kind of relationship.
file: Option<String>File where this edge originates.
line: Option<u32>Line number where this edge originates.
confidence: f32How sure we are this edge is real, in [0.0, 1.0].
An exact fully-qualified match is 1.0. A bare name matched only by
same-directory locality is far weaker, and an ambiguous match weaker
still. Consumers that need certainty should filter on this rather than
treating every edge as proven — see Edge::is_confident.
Implementations§
Source§impl Edge
impl Edge
Sourcepub const CONFIDENT_THRESHOLD: f32 = 0.75
pub const CONFIDENT_THRESHOLD: f32 = 0.75
Edges at or above this confidence are treated as established fact.
Sourcepub fn with_location(kind: EdgeKind, file: impl Into<String>, line: u32) -> Self
pub fn with_location(kind: EdgeKind, file: impl Into<String>, line: u32) -> Self
Creates an edge with location info.
Sourcepub fn with_confidence(self, confidence: f32) -> Self
pub fn with_confidence(self, confidence: f32) -> Self
Sets the confidence, clamped to [0.0, 1.0].
Sourcepub fn is_confident(&self) -> bool
pub fn is_confident(&self) -> bool
Whether this edge is strong enough to treat as certain.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Edge
impl<'de> Deserialize<'de> for Edge
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
Auto Trait Implementations§
impl Freeze for Edge
impl RefUnwindSafe for Edge
impl Send for Edge
impl Sync for Edge
impl Unpin for Edge
impl UnsafeUnpin for Edge
impl UnwindSafe for Edge
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