pub struct Edge {
pub source: String,
pub target: String,
pub edge_type: EdgeType,
pub symbols: Vec<String>,
pub weight: f32,
pub metadata: Option<EdgeMetadata>,
}Expand description
A full edge representation with metadata
Fields§
§source: StringSource chunk ID
target: StringTarget chunk ID
edge_type: EdgeTypeType of relationship
symbols: Vec<String>Specific symbol(s) involved in this edge
weight: f32Weight/importance (0.0 - 1.0)
metadata: Option<EdgeMetadata>Additional metadata
Implementations§
Source§impl Edge
impl Edge
Sourcepub fn new(
source: impl Into<String>,
target: impl Into<String>,
edge_type: EdgeType,
) -> Self
pub fn new( source: impl Into<String>, target: impl Into<String>, edge_type: EdgeType, ) -> Self
Create a new edge
Sourcepub fn with_symbols(self, symbols: Vec<String>) -> Self
pub fn with_symbols(self, symbols: Vec<String>) -> Self
Add symbols involved in this edge
Sourcepub fn with_weight(self, weight: f32) -> Self
pub fn with_weight(self, weight: f32) -> Self
Set the weight
Sourcepub fn with_metadata(self, metadata: EdgeMetadata) -> Self
pub fn with_metadata(self, metadata: EdgeMetadata) -> Self
Add metadata
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
Deserialize from storage
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 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