pub struct DiffSlicer { /* private fields */ }Expand description
Condenses unified diffs.
§Example
use boundgraph_slice::{DiffSlicer, MemoryStore, Raw, Slicer};
let patch = "\
diff --git a/src/main.rs b/src/main.rs
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,3 @@
fn main() {
- println!(\"old\");
+ println!(\"new\");
}
";
let condensate = tokio::runtime::Builder::new_current_thread()
.build()?
.block_on(DiffSlicer::new().condense(&Raw::new(patch), 400, &MemoryStore::new()))?;
assert!(!condensate.lossy, "a small patch survives whole");Implementations§
Trait Implementations§
Source§impl Clone for DiffSlicer
impl Clone for DiffSlicer
impl Copy for DiffSlicer
Source§impl Debug for DiffSlicer
impl Debug for DiffSlicer
Source§impl Default for DiffSlicer
impl Default for DiffSlicer
Source§impl Slicer for DiffSlicer
impl Slicer for DiffSlicer
Source§fn slice<'life0, 'life1, 'async_trait>(
&'life0 self,
raw: &'life1 Raw,
cap: usize,
) -> Pin<Box<dyn Future<Output = Result<Slice, SliceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn slice<'life0, 'life1, 'async_trait>(
&'life0 self,
raw: &'life1 Raw,
cap: usize,
) -> Pin<Box<dyn Future<Output = Result<Slice, SliceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Produce the summary. The part an implementation writes. Read more
Source§fn counter(&self) -> &dyn TokenCount
fn counter(&self) -> &dyn TokenCount
How this slicer counts tokens. Read more
Source§fn minimum_cap(&self) -> usize
fn minimum_cap(&self) -> usize
The least a summary from this slicer can cost. Read more
Source§fn condense<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
raw: &'life1 Raw,
cap: usize,
store: &'life2 dyn Store,
) -> Pin<Box<dyn Future<Output = Result<Condensate, SliceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn condense<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
raw: &'life1 Raw,
cap: usize,
store: &'life2 dyn Store,
) -> Pin<Box<dyn Future<Output = Result<Condensate, SliceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Preserve the original, slice it, and check the result fits. Read more
Auto Trait Implementations§
impl Freeze for DiffSlicer
impl RefUnwindSafe for DiffSlicer
impl Send for DiffSlicer
impl Sync for DiffSlicer
impl Unpin for DiffSlicer
impl UnsafeUnpin for DiffSlicer
impl UnwindSafe for DiffSlicer
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