pub struct TransformPlan {
pub edits: Vec<Edit>,
pub report: ScanReport,
}Expand description
The scan and edits of a transformation, before output bytes are built.
Planning is the useful half of a transformation for a checker, a report
renderer, or a caller that wants to inspect or filter edits. It deliberately
carries neither a copy of the transformed source nor a source map. Call
Self::finish only when those materialized results are needed.
Fields§
§edits: Vec<Edit>The edits selected by the scan, sorted and non-overlapping.
report: ScanReportThe scan those edits were decided from.
Implementations§
Source§impl TransformPlan
impl TransformPlan
Sourcepub fn finish(self, source: &[u8]) -> TransformResult
pub fn finish(self, source: &[u8]) -> TransformResult
Apply this plan and build its source map.
§Panics
Panics when source is not the source the plan was made for and an
edit consequently lies outside it, just like apply_edits.
Sourcepub fn output(&self, source: &[u8]) -> Vec<u8> ⓘ
pub fn output(&self, source: &[u8]) -> Vec<u8> ⓘ
Build only the transformed bytes, leaving the plan available.
Sourcepub fn source_map(&self, source_len: usize) -> SourceMap
pub fn source_map(&self, source_len: usize) -> SourceMap
Build only the source map, leaving the plan available.
Trait Implementations§
Source§impl Clone for TransformPlan
impl Clone for TransformPlan
Source§fn clone(&self) -> TransformPlan
fn clone(&self) -> TransformPlan
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 TransformPlan
impl Debug for TransformPlan
Source§impl Default for TransformPlan
impl Default for TransformPlan
Source§fn default() -> TransformPlan
fn default() -> TransformPlan
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for TransformPlan
impl<'de> Deserialize<'de> for TransformPlan
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
impl Eq for TransformPlan
Source§impl PartialEq for TransformPlan
impl PartialEq for TransformPlan
Source§impl Serialize for TransformPlan
impl Serialize for TransformPlan
impl StructuralPartialEq for TransformPlan
Auto Trait Implementations§
impl Freeze for TransformPlan
impl RefUnwindSafe for TransformPlan
impl Send for TransformPlan
impl Sync for TransformPlan
impl Unpin for TransformPlan
impl UnsafeUnpin for TransformPlan
impl UnwindSafe for TransformPlan
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