pub struct CodeSuggestion {
pub substitution_parts: Vec<Substitution>,
pub msg: String,
}
Fields§
§substitution_parts: Vec<Substitution>
Each substitute can have multiple variants due to multiple applicable suggestions
foo.bar
might be replaced with a.b
or x.y
by replacing
foo
and bar
on their own:
ⓘ
vec![
(0..3, vec!["a", "x"]),
(4..7, vec!["b", "y"]),
]
or by replacing the entire span:
ⓘ
vec![(0..7, vec!["a.b", "x.y"])]
msg: String
Implementations§
Source§impl CodeSuggestion
impl CodeSuggestion
Sourcepub fn substitution_spans<'a>(
&'a self,
) -> Map<<&'a Vec<Substitution> as IntoIterator>::IntoIter, fn(&Substitution) -> Span>
pub fn substitution_spans<'a>( &'a self, ) -> Map<<&'a Vec<Substitution> as IntoIterator>::IntoIter, fn(&Substitution) -> Span>
Returns the number of substitutions
Sourcepub fn splice_lines(&self, cm: &dyn CodeMapper) -> Vec<String>
pub fn splice_lines(&self, cm: &dyn CodeMapper) -> Vec<String>
Returns the assembled code suggestions.
Trait Implementations§
Source§impl Clone for CodeSuggestion
impl Clone for CodeSuggestion
Source§fn clone(&self) -> CodeSuggestion
fn clone(&self) -> CodeSuggestion
Returns a copy of the value. Read more
1.0.0 · 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 CodeSuggestion
impl Debug for CodeSuggestion
Source§impl<'de> Deserialize<'de> for CodeSuggestion
impl<'de> Deserialize<'de> for CodeSuggestion
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
Source§impl PartialEq for CodeSuggestion
impl PartialEq for CodeSuggestion
Source§impl Serialize for CodeSuggestion
impl Serialize for CodeSuggestion
impl StructuralPartialEq for CodeSuggestion
Auto Trait Implementations§
impl Freeze for CodeSuggestion
impl RefUnwindSafe for CodeSuggestion
impl Send for CodeSuggestion
impl Sync for CodeSuggestion
impl Unpin for CodeSuggestion
impl UnwindSafe for CodeSuggestion
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