pub struct HunkId(/* private fields */);Expand description
A canonical hunk, in memory.
The wire form is h<N>, where N indexes doc.hunks — frozen since schema
v1 and unchanged by this type. HunkId is only ever the parsed form: it
never crosses a serde boundary, so the contract stays exactly as
spec/json-contract.md describes it while callers stop re-parsing strings.
Implementations§
Source§impl HunkId
impl HunkId
pub const fn from_index(index: usize) -> Self
pub const fn index(self) -> usize
Sourcepub fn parse(s: &str) -> Result<Self, EngineError>
pub fn parse(s: &str) -> Result<Self, EngineError>
Parse the wire form.
Fallible on purpose. A malformed id means the document contradicts its own contract, which is impossible for a document this process just produced and possible for one read back from a review store — so the caller gets an error to propagate instead of a panic.
Trait Implementations§
impl Copy for HunkId
impl Eq for HunkId
Source§impl Ord for HunkId
impl Ord for HunkId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for HunkId
impl PartialOrd for HunkId
impl StructuralPartialEq for HunkId
Auto Trait Implementations§
impl Freeze for HunkId
impl RefUnwindSafe for HunkId
impl Send for HunkId
impl Sync for HunkId
impl Unpin for HunkId
impl UnsafeUnpin for HunkId
impl UnwindSafe for HunkId
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§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.