pub struct DesignChoiceSet {
pub suggestion_id: SuggestId,
pub pattern_name: String,
pub choices: Vec<DesignChoice>,
pub recommended: Option<ChoiceId>,
}Expand description
A set of design choices for a single suggestion.
When a suggestion has multiple valid approaches, this type groups them together with a recommended default.
Fields§
§suggestion_id: SuggestIdID of the parent suggestion.
pattern_name: StringName of the pattern that generated these choices (e.g., “EnumToTrait”).
choices: Vec<DesignChoice>Available choices.
recommended: Option<ChoiceId>Recommended choice ID (if any).
Implementations§
Source§impl DesignChoiceSet
impl DesignChoiceSet
Sourcepub fn new(
suggestion_id: SuggestId,
pattern_name: impl Into<String>,
) -> DesignChoiceSet
pub fn new( suggestion_id: SuggestId, pattern_name: impl Into<String>, ) -> DesignChoiceSet
Create a new choice set.
Sourcepub fn add_choice(self, choice: DesignChoice) -> DesignChoiceSet
pub fn add_choice(self, choice: DesignChoice) -> DesignChoiceSet
Add a choice to the set.
Sourcepub fn with_recommended(self, id: impl Into<ChoiceId>) -> DesignChoiceSet
pub fn with_recommended(self, id: impl Into<ChoiceId>) -> DesignChoiceSet
Set the recommended choice.
Sourcepub fn get_choice(&self, id: &ChoiceId) -> Option<&DesignChoice>
pub fn get_choice(&self, id: &ChoiceId) -> Option<&DesignChoice>
Get a choice by ID.
Sourcepub fn get_recommended(&self) -> Option<&DesignChoice>
pub fn get_recommended(&self) -> Option<&DesignChoice>
Get the recommended choice (if set and exists).
Sourcepub fn has_alternatives(&self) -> bool
pub fn has_alternatives(&self) -> bool
Check if this set has multiple choices.
Sourcepub fn choice_count(&self) -> usize
pub fn choice_count(&self) -> usize
Get the number of choices.
Sourcepub fn choices_by_score(&self) -> Vec<&DesignChoice>
pub fn choices_by_score(&self) -> Vec<&DesignChoice>
Get choices sorted by trade-off score (highest first).
Trait Implementations§
Source§impl Clone for DesignChoiceSet
impl Clone for DesignChoiceSet
Source§fn clone(&self) -> DesignChoiceSet
fn clone(&self) -> DesignChoiceSet
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DesignChoiceSet
impl Debug for DesignChoiceSet
Source§impl<'de> Deserialize<'de> for DesignChoiceSet
impl<'de> Deserialize<'de> for DesignChoiceSet
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DesignChoiceSet, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DesignChoiceSet, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for DesignChoiceSet
impl Serialize for DesignChoiceSet
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,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for DesignChoiceSet
impl RefUnwindSafe for DesignChoiceSet
impl Send for DesignChoiceSet
impl Sync for DesignChoiceSet
impl Unpin for DesignChoiceSet
impl UnsafeUnpin for DesignChoiceSet
impl UnwindSafe for DesignChoiceSet
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
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>
Converts
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>
Converts
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