Struct rspack_sources::ReplaceSource
source · pub struct ReplaceSource<T> { /* private fields */ }
Expand description
Decorates a Source with replacements and insertions of source code, usually used in dependencies
use rspack_sources::{OriginalSource, ReplaceSource, Source};
let code = "hello world\n";
let mut source = ReplaceSource::new(OriginalSource::new(code, "file.txt"));
source.insert(0, "start1\n", None);
source.replace(0, 0, "start2\n", None);
source.replace(999, 10000, "end2", None);
source.insert(888, "end1\n", None);
source.replace(0, 999, "replaced!\n", Some("whole"));
assert_eq!(source.source(), "start1\nstart2\nreplaced!\nend1\nend2");
Implementations§
source§impl<T> ReplaceSource<T>
impl<T> ReplaceSource<T>
Trait Implementations§
source§impl<T: Source> Clone for ReplaceSource<T>
impl<T: Source> Clone for ReplaceSource<T>
source§impl<T: Debug> Debug for ReplaceSource<T>
impl<T: Debug> Debug for ReplaceSource<T>
source§impl<T: Hash> Hash for ReplaceSource<T>
impl<T: Hash> Hash for ReplaceSource<T>
source§impl<T: PartialEq> PartialEq for ReplaceSource<T>
impl<T: PartialEq> PartialEq for ReplaceSource<T>
source§impl<T: Source + Hash + PartialEq + Eq + 'static> Source for ReplaceSource<T>
impl<T: Source + Hash + PartialEq + Eq + 'static> Source for ReplaceSource<T>
source§impl<T: Source> StreamChunks for ReplaceSource<T>
impl<T: Source> StreamChunks for ReplaceSource<T>
source§fn stream_chunks(
&self,
options: &MapOptions,
on_chunk: OnChunk<'_>,
on_source: OnSource<'_>,
on_name: OnName<'_>,
) -> GeneratedInfo
fn stream_chunks( &self, options: &MapOptions, on_chunk: OnChunk<'_>, on_source: OnSource<'_>, on_name: OnName<'_>, ) -> GeneratedInfo
StreamChunks abstraction
impl<T: Eq> Eq for ReplaceSource<T>
Auto Trait Implementations§
impl<T> !Freeze for ReplaceSource<T>
impl<T> RefUnwindSafe for ReplaceSource<T>where
T: RefUnwindSafe,
impl<T> Send for ReplaceSource<T>
impl<T> Sync for ReplaceSource<T>
impl<T> Unpin for ReplaceSource<T>
impl<T> UnwindSafe for ReplaceSource<T>where
T: RefUnwindSafe,
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)