pub struct SuggestOpportunity {
pub id: OpportunityId,
pub targets: Vec<SymbolId>,
pub location: SuggestLocation,
pub message: String,
pub confidence: f32,
pub context: OpportunityContext,
pub scope: SymbolScope,
}Expand description
A detected opportunity for improvement
Fields§
§id: OpportunityIdUnique ID within this detection run
targets: Vec<SymbolId>Target symbol(s) for this opportunity
location: SuggestLocationPrimary location for display
message: StringHuman-readable suggestion message
confidence: f32Confidence score (0.0 - 1.0)
context: OpportunityContextPattern-specific context (type-safe via enum)
scope: SymbolScopeCode scope where this opportunity was detected
Implementations§
Source§impl SuggestOpportunity
impl SuggestOpportunity
Sourcepub fn new(
id: OpportunityId,
targets: Vec<SymbolId>,
location: SuggestLocation,
message: impl Into<String>,
confidence: f32,
context: OpportunityContext,
) -> SuggestOpportunity
pub fn new( id: OpportunityId, targets: Vec<SymbolId>, location: SuggestLocation, message: impl Into<String>, confidence: f32, context: OpportunityContext, ) -> SuggestOpportunity
Create a new opportunity
Scope defaults to Lib. The pipeline (detect_with_config) resolves
and overwrites the scope based on symbol context.
Sourcepub fn with_scope(self, scope: SymbolScope) -> SuggestOpportunity
pub fn with_scope(self, scope: SymbolScope) -> SuggestOpportunity
Set the scope for this opportunity
Sourcepub fn primary_target(&self) -> Option<SymbolId>
pub fn primary_target(&self) -> Option<SymbolId>
Get the primary target symbol (first in the list)
Sourcepub fn with_severity_override(
self,
new_severity: LintSeverity,
) -> SuggestOpportunity
pub fn with_severity_override( self, new_severity: LintSeverity, ) -> SuggestOpportunity
Override severity for Lint context.
Only affects Lint context - other contexts are unchanged. Returns self for chaining.
Sourcepub fn lint_severity(&self) -> Option<LintSeverity>
pub fn lint_severity(&self) -> Option<LintSeverity>
Get the lint severity if this is a Lint context
Sourcepub fn with_suggestion(
self,
suggestion: impl Into<String>,
) -> SuggestOpportunity
pub fn with_suggestion( self, suggestion: impl Into<String>, ) -> SuggestOpportunity
Set suggestion text for Lint or Spec context. Returns self for chaining.
Sourcepub fn with_expected_actual(
self,
expected: impl Into<String>,
actual: impl Into<String>,
) -> SuggestOpportunity
pub fn with_expected_actual( self, expected: impl Into<String>, actual: impl Into<String>, ) -> SuggestOpportunity
Set expected/actual for Lint context. Returns self for chaining.
Set related types for Spec context. Returns self for chaining.
Sourcepub fn with_confidence(self, confidence: f32) -> SuggestOpportunity
pub fn with_confidence(self, confidence: f32) -> SuggestOpportunity
Override confidence score. Returns self for chaining.
Trait Implementations§
Source§impl Clone for SuggestOpportunity
impl Clone for SuggestOpportunity
Source§fn clone(&self) -> SuggestOpportunity
fn clone(&self) -> SuggestOpportunity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SuggestOpportunity
impl Debug for SuggestOpportunity
Source§impl<'de> Deserialize<'de> for SuggestOpportunity
impl<'de> Deserialize<'de> for SuggestOpportunity
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SuggestOpportunity, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SuggestOpportunity, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for SuggestOpportunity
impl Serialize for SuggestOpportunity
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for SuggestOpportunity
impl RefUnwindSafe for SuggestOpportunity
impl Send for SuggestOpportunity
impl Sync for SuggestOpportunity
impl Unpin for SuggestOpportunity
impl UnsafeUnpin for SuggestOpportunity
impl UnwindSafe for SuggestOpportunity
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more