Struct ide::SourceChange
source · pub struct SourceChange {
pub source_file_edits: HashMap<FileId, (TextEdit, Option<SnippetEdit>), BuildHasherDefault<NoHashHasher<FileId>>>,
pub file_system_edits: Vec<FileSystemEdit>,
pub is_snippet: bool,
}
Fields§
§source_file_edits: HashMap<FileId, (TextEdit, Option<SnippetEdit>), BuildHasherDefault<NoHashHasher<FileId>>>
§file_system_edits: Vec<FileSystemEdit>
§is_snippet: bool
Implementations§
source§impl SourceChange
impl SourceChange
sourcepub fn from_edits(
source_file_edits: HashMap<FileId, (TextEdit, Option<SnippetEdit>), BuildHasherDefault<NoHashHasher<FileId>>>,
file_system_edits: Vec<FileSystemEdit>,
) -> SourceChange
pub fn from_edits( source_file_edits: HashMap<FileId, (TextEdit, Option<SnippetEdit>), BuildHasherDefault<NoHashHasher<FileId>>>, file_system_edits: Vec<FileSystemEdit>, ) -> SourceChange
Creates a new SourceChange with the given label from the edits.
pub fn from_text_edit( file_id: impl Into<FileId>, edit: TextEdit, ) -> SourceChange
sourcepub fn insert_source_edit(&mut self, file_id: impl Into<FileId>, edit: TextEdit)
pub fn insert_source_edit(&mut self, file_id: impl Into<FileId>, edit: TextEdit)
sourcepub fn insert_source_and_snippet_edit(
&mut self,
file_id: impl Into<FileId>,
edit: TextEdit,
snippet_edit: Option<SnippetEdit>,
)
pub fn insert_source_and_snippet_edit( &mut self, file_id: impl Into<FileId>, edit: TextEdit, snippet_edit: Option<SnippetEdit>, )
Inserts a TextEdit
and potentially a SnippetEdit
for the given FileId
.
This properly handles merging existing edits for a file if some already exist.
pub fn push_file_system_edit(&mut self, edit: FileSystemEdit)
pub fn get_source_and_snippet_edit( &self, file_id: FileId, ) -> Option<&(TextEdit, Option<SnippetEdit>)>
pub fn merge(self, other: SourceChange) -> SourceChange
Trait Implementations§
source§impl Clone for SourceChange
impl Clone for SourceChange
source§fn clone(&self) -> SourceChange
fn clone(&self) -> SourceChange
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 SourceChange
impl Debug for SourceChange
source§impl Default for SourceChange
impl Default for SourceChange
source§fn default() -> SourceChange
fn default() -> SourceChange
Returns the “default value” for a type. Read more
source§impl Extend<(FileId, (TextEdit, Option<SnippetEdit>))> for SourceChange
impl Extend<(FileId, (TextEdit, Option<SnippetEdit>))> for SourceChange
source§fn extend<T>(&mut self, iter: T)
fn extend<T>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl Extend<(FileId, TextEdit)> for SourceChange
impl Extend<(FileId, TextEdit)> for SourceChange
source§fn extend<T>(&mut self, iter: T)
fn extend<T>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl Extend<FileSystemEdit> for SourceChange
impl Extend<FileSystemEdit> for SourceChange
source§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = FileSystemEdit>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = FileSystemEdit>,
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl From<FileSystemEdit> for SourceChange
impl From<FileSystemEdit> for SourceChange
source§fn from(edit: FileSystemEdit) -> SourceChange
fn from(edit: FileSystemEdit) -> SourceChange
Converts to this type from the input type.
source§impl From<HashMap<FileId, TextEdit, BuildHasherDefault<NoHashHasher<FileId>>>> for SourceChange
impl From<HashMap<FileId, TextEdit, BuildHasherDefault<NoHashHasher<FileId>>>> for SourceChange
source§fn from(
source_file_edits: HashMap<FileId, TextEdit, BuildHasherDefault<NoHashHasher<FileId>>>,
) -> SourceChange
fn from( source_file_edits: HashMap<FileId, TextEdit, BuildHasherDefault<NoHashHasher<FileId>>>, ) -> SourceChange
Converts to this type from the input type.
source§impl FromIterator<(FileId, TextEdit)> for SourceChange
impl FromIterator<(FileId, TextEdit)> for SourceChange
source§fn from_iter<T>(iter: T) -> SourceChange
fn from_iter<T>(iter: T) -> SourceChange
Creates a value from an iterator. Read more
Auto Trait Implementations§
impl Freeze for SourceChange
impl RefUnwindSafe for SourceChange
impl Send for SourceChange
impl Sync for SourceChange
impl Unpin for SourceChange
impl UnwindSafe for SourceChange
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
§impl<T> Cast for T
impl<T> Cast for T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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