#[non_exhaustive]pub struct Overlap {
pub source_id: String,
pub target_id: String,
pub edge_type: String,
pub valid_from: String,
pub valid_to: String,
pub existing_from: String,
pub existing_to: String,
pub within_batch: bool,
}Expand description
The two intervals of a DbError::OverlappingInterval, boxed out of the
error enum (D-075).
Both are reported because neither alone identifies the conflict: the caller knows what they asserted and not what it collided with, and a message naming only the other interval reads as though the assertion were the innocent one.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.source_id: String§target_id: String§edge_type: String§valid_from: StringThe interval the caller asserted.
valid_to: String§existing_from: StringThe interval it collides with — see Overlap::within_batch for where
that one is, because it is not always in the database.
existing_to: String§within_batch: boolWhether the collision is with another edge in the same call (0.13.7, D-180).
Two guards raise this one error. reject_overlapping_interval compares
the assertion against committed rows; reject_overlaps_within compares
a batch against itself, before the transaction opens, and nothing it
names is in the database — the batch is refused whole, so nothing it
names ever will be. A caller told an edge “already holds” an interval
goes looking for a row that is not there.
Implementations§
Source§impl Overlap
impl Overlap
Sourcepub fn new(
source_id: impl Into<String>,
target_id: impl Into<String>,
edge_type: impl Into<String>,
asserted: (impl Into<String>, impl Into<String>),
existing: (impl Into<String>, impl Into<String>),
within_batch: bool,
) -> Self
pub fn new( source_id: impl Into<String>, target_id: impl Into<String>, edge_type: impl Into<String>, asserted: (impl Into<String>, impl Into<String>), existing: (impl Into<String>, impl Into<String>), within_batch: bool, ) -> Self
The collision, as the edge it is about and the two intervals.
Grouped rather than taken as eight strings, because the grouping is the
struct’s actual shape — D-075 boxed it out of the enum precisely
because it is two intervals — and eight positional Strings is a
signature in which existing_from and valid_from can be swapped
without the compiler noticing. Added in 0.15.13 with
#[non_exhaustive] (W15.3, D-255): the crate raises this error and no
caller has to build one, but our own binding builds a sample of every
variant to check its error mapping, and a type nothing outside the crate
can construct is a type nothing outside the crate can test against.
Sourcepub fn provenance(&self) -> &'static str
pub fn provenance(&self) -> &'static str
The message’s closing clause: where the second interval came from.
A method rather than two #[error] strings, because one variant gets
one format string, and rather than a String because this is on a
Display path.
Trait Implementations§
impl Eq for Overlap
impl StructuralPartialEq for Overlap
Auto Trait Implementations§
impl Freeze for Overlap
impl RefUnwindSafe for Overlap
impl Send for Overlap
impl Sync for Overlap
impl Unpin for Overlap
impl UnsafeUnpin for Overlap
impl UnwindSafe for Overlap
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
key and return true if they are equal.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
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request