pub struct DegreeSampler;Expand description
A sampler that counts each node’s direct neighbors (degree centrality). Demonstrates the pattern and is useful as a lightweight structural signal.
Trait Implementations§
Source§impl Sampler for DegreeSampler
impl Sampler for DegreeSampler
Source§fn selector(&self) -> NodeSelector
fn selector(&self) -> NodeSelector
Which nodes this sampler operates on.
Source§fn compute(
&self,
ctx: &SampleContext<'_>,
) -> Result<Option<Value>, SamplerError>
fn compute( &self, ctx: &SampleContext<'_>, ) -> Result<Option<Value>, SamplerError>
Compute the artifact for a single node.
Return
Ok(None) to skip a node without error.Source§fn sample(
&self,
graph: &SourceCodeGraph,
annotations: &AnnotationMap,
) -> Result<SampleResult, SamplerError>
fn sample( &self, graph: &SourceCodeGraph, annotations: &AnnotationMap, ) -> Result<SampleResult, SamplerError>
Run the full sampling pass over a graph. Read more
Auto Trait Implementations§
impl Freeze for DegreeSampler
impl RefUnwindSafe for DegreeSampler
impl Send for DegreeSampler
impl Sync for DegreeSampler
impl Unpin for DegreeSampler
impl UnsafeUnpin for DegreeSampler
impl UnwindSafe for DegreeSampler
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