Skip to main content

ColumnEq

Trait ColumnEq 

Source
pub trait ColumnEq {
    // Required method
    fn column_eq(&self, other: &Self) -> bool;
}
Expand description

Whether two values of this column type are the same value.

§It is PartialEq for a type that has one, and the row says so

Almost every row in this crate is self == other, written through the same table that states the type’s width. What the face buys is the type that has no PartialEq and cannot be given one: its row says what sameness means for it, in its own terms, in the crate that stores it.

§The contract is PartialEq’s, because that is what it is spent as

An emitted impl PartialEq for <Record><Db> folds this over the row’s fields, so a row inherits whatever this row promises: symmetry and transitivity where the type has them, and no reflexivity claim (f64’s NaN is a column value, and NaN != NaN stays true through the fold). A row that disagreed with its own type’s == would make a record’s equality mean one thing at the field and another at the row, so a type carrying PartialEq writes self == other and nothing else.

§Joining from outside

A downstream citizen adds impl ColumnEq for MyScalar { fn column_eq(&self, other: &Self) -> bool { self == other } } beside the ColumnKind row it already writes. #[derive(ingraph::Id)], #[ingraph::enumeration], #[ingraph::flags], #[ingraph::newtype] and #[ingraph::fields] write it for what they declare, so a declaration road never has to.

§Examples

use ingraph::ColumnEq;

assert!(7i64.column_eq(&7));
assert!(!"a".column_eq(&"b"));
// The row is `PartialEq`'s, so a partial equivalence stays partial.
assert!(!f64::NAN.column_eq(&f64::NAN));

An absent value is the same as an absent value, and never the same as a present one:

use ingraph::ColumnEq;

assert!(None::<i64>.column_eq(&None));
assert!(!None::<i64>.column_eq(&Some(0)));

Required Methods§

Source

fn column_eq(&self, other: &Self) -> bool

Whether self and other are the same stored value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ColumnEq for Date

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for Duration

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for IpAddr

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for Ipv4Addr

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for Ipv6Addr

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for NonZeroI8

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for NonZeroI16

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for NonZeroI32

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for NonZeroI64

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for NonZeroI128

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for NonZeroU8

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for NonZeroU16

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for NonZeroU32

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for NonZeroU64

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for NonZeroU128

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for ObjectId

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for OffsetDateTime

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for PgInterval

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for PrimitiveDateTime

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for Regex

Available on crate feature regex only.

THE PATTERN’S IDENTITY IS ITS TEXT, and this row is where that law is spent rather than merely stated.

A pattern column stores Regex::as_str’s text and reads it back through Regex::new (see assemble), so the text is the whole of what a store holds. Sameness is therefore the same text, byte for byte: two patterns are one column value exactly when one was written from the other’s characters.

§It CANONICALISES NOTHING, and that is the law rather than a shortfall

(?i)a and [aA] accept the same strings and are two values, two rows and two answers here — as a{2} and aa are. A uuid folds four spellings into one and an IPv6 address folds many into RFC 5952; a pattern has no such normal form, and inventing one would make a column claim an equivalence the engine that matches with it does not have.

§A RegexBuilder FLAG IS OUTSIDE THE IDENTITY, which is the one thing a reader must know

RegexBuilder sets case-insensitivity, multi-line, dot_matches_new_line and the size limits OUTSIDE the pattern text, and as_str reports the text alone. So two patterns built from one string with different builder flags are the SAME column value here, match differently at runtime, and round-trip through a store as the flagless one — because the store never held the flags. A declaration that needs a flag to survive storage writes it INTO the pattern ((?i) and its siblings are inline and are part of as_str), which is the spelling that is stored, compared, published and paged as one thing.

The same text is the same value on every face: the SQL bind, the BSON document, the wire scalar and the page cursor all carry as_str, so this row is not a second opinion about a pattern but the one opinion read at the row.

§Examples

One text, one value — and a pattern that came back out of a store is the one that went in:

use ingraph::ColumnEq;

let written = regex::Regex::new(r"^\d{4}-\d{2}$").expect("a pattern");
let read_back = regex::Regex::new(written.as_str()).expect("the stored text still compiles");
assert!(written.column_eq(&read_back));

Two patterns that accept the same strings are two values, because a pattern canonicalises nothing:

use ingraph::ColumnEq;

let inline = regex::Regex::new("(?i)a").expect("a pattern");
let spelled = regex::Regex::new("[aA]").expect("a pattern");
assert!(!inline.column_eq(&spelled));

A RegexBuilder flag is outside the identity, so two patterns built from one text are one value here however they were built — and the store holds the text alone:

use ingraph::ColumnEq;

let plain = regex::Regex::new("a").expect("a pattern");
let folded = regex::RegexBuilder::new("a")
  .case_insensitive(true)
  .build()
  .expect("a pattern");

assert_eq!(plain.as_str(), folded.as_str());
assert!(plain.column_eq(&folded));
// They do NOT match the same strings — which is why a flag that must survive storage is
// written INTO the pattern, where `as_str` reports it.
assert!(!plain.is_match("A"));
assert!(folded.is_match("A"));
Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for SmolStr

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for SocketAddr

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for SocketAddrV4

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for SocketAddrV6

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for String

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for Time

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for Uuid

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for Uuid

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for bool

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for f32

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for f64

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for i8

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for i16

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for i32

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for i64

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for i128

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for str

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for u8

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for u16

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for u32

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for u64

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl ColumnEq for u128

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl<T: ColumnEq + ?Sized> ColumnEq for &T

A borrow is the same as a borrow when what they point at is.

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl<T: ColumnEq> ColumnEq for Option<T>

Absent is absent, present is present, and the two are never each other.

This is the shape a nullable column actually takes — Option<T> is what an optional field’s row field holds — so it is the row most emitted comparisons reach.

Source§

fn column_eq(&self, other: &Self) -> bool

Source§

impl<T: ColumnEq> ColumnEq for Vec<T>

A collection is the same as a collection when it holds the same elements in the same order.

Length first, which is what PartialEq for Vec<T> does too — and the order is load-bearing: an edge-stored collection is read back in its stored sequence, so two orders are two values.

Source§

fn column_eq(&self, other: &Self) -> bool

Implementors§

Source§

impl ColumnEq for AudioCodec

Available on crate feature mediaframe only.

A codec is the same as a codec when its canonical slug is — one column, one comparison.

Source§

impl ColumnEq for BarcodePayloadKind

Source§

impl ColumnEq for BeI128

Source§

impl ColumnEq for BeU64

Source§

impl ColumnEq for BeU128

Source§

impl ColumnEq for Count

Source§

impl ColumnEq for DetectedLanguage

Available on crate feature derive only.
Source§

impl ColumnEq for Detection

Source§

impl ColumnEq for Label

Source§

impl ColumnEq for Language

Available on crate feature derive only.

A subtag is the same as a subtag when its canonical text is — one column, one comparison.

Source§

impl ColumnEq for LanguageId

Available on crate feature derive only.
Source§

impl ColumnEq for LocalTimestamp

Available on crate features derive and time only.
Source§

impl ColumnEq for LocalTimestampLeaf

Available on crate features derive and time only.
Source§

impl ColumnEq for MediaTimeRange

Available on crate feature mediatime only.
Source§

impl ColumnEq for MediaTimeRangeLeaf

Available on crate feature mediatime only.
Source§

impl ColumnEq for MediaTimestamp

Available on crate feature mediatime only.

A media instant is one column value when its ENCODING is — the count it declares and the timebase it counts in — and NOT merely when the two name the same instant.

mediatime::Timestamp’s own PartialEq is cmp_semantic: a cross-timebase comparison of the exact rational instant, so 900 @ 1/1000 and 1_800_000 @ 1/2_000_000_000 are ONE value under == despite storing two different pts columns. That is exactly the SEMANTIC identity this citizen’s own eq filter slot asks for — see MediaTimestampFilter’s table, where exact and eq are two different questions on purpose. A row’s stored columns hold the ENCODING, so folding == here would make a record’s row equality answer the semantic question instead of the structural one the columns actually hold.

So this row is written by hand: the count, exactly as stored, and the timebase through its own (reduction-consistent) row.

Source§

impl ColumnEq for MediaTimestampLeaf

Available on crate feature mediatime only.
Source§

impl ColumnEq for MySqlDuration

Source§

impl ColumnEq for NormCoord

Source§

impl ColumnEq for PgDuration

Source§

impl ColumnEq for Rate

Available on crate feature mediatime only.
Source§

impl ColumnEq for Region

Available on crate feature derive only.

A subtag is the same as a subtag when its canonical text is — one column, one comparison.

Source§

impl ColumnEq for ScriptSubtag

Available on crate feature derive only.

A subtag is the same as a subtag when its canonical text is — one column, one comparison.

Source§

impl ColumnEq for SubtitleCodec

Available on crate feature mediaframe only.

A codec is the same as a codec when its canonical slug is — one column, one comparison.

Source§

impl ColumnEq for Symbology

Source§

impl ColumnEq for TimeRange

Source§

impl ColumnEq for Timebase

Available on crate feature mediatime only.
Source§

impl ColumnEq for Timestamp

Source§

impl ColumnEq for Utf8Bytes

Source§

impl ColumnEq for VideoCodec

Available on crate feature mediaframe only.

A codec is the same as a codec when its canonical slug is — one column, one comparison.

Source§

impl<I: ColumnEq, E> ColumnEq for TypedId<I, E>

A typed id is the same as a typed id when the ID is — the marker reaches no column, so it reaches no comparison either. The bound is the id’s alone, exactly as the width row’s is.

Source§

impl<S: ConfidenceCarrier + ColumnEq> ColumnEq for Confidence<S>

A confidence is the same as a confidence when the WIDTH it is measured in says so — one generic row over the width, for the same reason the width row above is one: a row per carrier would make this trait’s rendered implementer list depend on the vocabulary a build takes.

Source§

impl<T: ColumnEq> ColumnEq for BarcodeDetection<T>

A decoded code is one column value when its payload, its standard, its confidence and its region all are — the region through its own row, so the box’s derived area plays no part in what the box itself compares equal.

Source§

impl<T: ColumnEq> ColumnEq for BarcodeDetectionLeaf<T>

One leaf is the same as another leaf when it is the SAME leaf holding the same value — never across kinds, so a payload is never equal to a symbology even where both happen to compare true against another value of their own kind.

Source§

impl<T: ColumnEq> ColumnEq for BoundingBox<T>

A rectangle is one column value when its four VALUE leaves are — x, y, width and height — and never the derived area: the fold below reads only the four columns a row actually holds, exactly as the row-value equality this face replaces does.

Source§

impl<T: ColumnEq> ColumnEq for BoundingBoxLeaf<T>

One leaf is the same as another leaf when it is the SAME leaf holding the same component — never across kinds, and there is no member for the derived area to be one of them.

Source§

impl<T: ColumnEq> ColumnEq for DocumentSegment<T>

A segment is one column value when its four corners and its confidence all are — every one of the nine holds the value, so the fold is the whole of the row.

Source§

impl<T: ColumnEq> ColumnEq for LocatedDetection<T>

A located detection is one column value when its classification and its region both are — the classification through its own row, so the box’s derived area plays no part in what the box itself compares equal.

Source§

impl<T: ColumnEq> ColumnEq for LocatedDetectionLeaf<T>

One leaf is the same as another leaf when it is the SAME leaf holding the same value — never across kinds, so a label is never equal to a confidence even where both compare true against another value of their own kind.

Source§

impl<T: ColumnEq> ColumnEq for Point2<T>

A position is one column value when both its components are.

Source§

impl<T: ColumnEq> ColumnEq for Quad<T>

A quadrilateral is one column value when all four of its corners are, in winding order — the same order the columns nest under.

Source§

impl<T: ColumnEq> ColumnEq for Radians<T>

THE SAMENESS — an angle is the same as another wherever T’s own ColumnEq says so. BoundingBox<T>/Point2<T>/Quad<T> each fold this over their several fields; Radians<T> has exactly one, so the fold is that field’s own answer and nothing more — the column_eq! macro’s shape is not this row’s, because that macro is self == other for a CONCRETE type with its own PartialEq, and T here is neither concrete nor guaranteed one.

Source§

impl<T: ColumnEq> ColumnEq for Temporal<T>

Available on crate features jiff and time only.

The temporal wrapper is its inner type’s sameness, delegating exactly as its width row does.

Source§

impl<T: ColumnEq> ColumnEq for TextDetection<T>

A reading is one column value when its words, its confidence and its region all are — the region through its own row, so the box’s derived area plays no part in what the box itself compares equal.

Source§

impl<T: ColumnEq> ColumnEq for TextDetectionLeaf<T>

One leaf is the same as another leaf when it is the SAME leaf holding the same value — never across kinds, so the words are never equal to a confidence even where both compare true against another value of their own kind.

Source§

impl<T: ColumnEq> ColumnEq for TimeRanged<T>

A timed payload is one column value when its stretch and its payload both are — the range through its own row, the payload through the bound this wrapper carries.