You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d8aeadb
Browse filesBrowse the repository at this point in the historyBrowse files
docs(stack-encrypt): rewrite the order index docs in plain language
The docs that explain why an order index refuses bytes now use short
sentences with one idea each. They say that an operator accepts a type,
where they said that an operator is answered over a type. The note on
the Index error lists what each index accepts.
Copy file name to clipboardExpand all lines: packages/stack-encrypt/src/target/index.rs
+24-19Lines changed: 24 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -188,13 +188,15 @@ impl fmt::Display for IndexSpec {
188
188
189
189
/// An operation that derives one search term of `S`.
190
190
///
191
-
/// Implemented for exactly the plaintexts the index answers a query over,
192
-
/// which is what makes an inapplicable index a compile error: there is no
193
-
/// `Index<u32>` for [`Match`](struct@Match), because match is defined over
194
-
/// text. An order index ([`Ore`], [`Ope`], [`OreBlock`]) is implemented for
195
-
/// the types an ordering operator is answered over
196
-
/// ([`op::Ordered`](crate::op::Ordered)). Its scheme can also order bytes,
197
-
/// but no ordering operator is answered over bytes, so there is no
191
+
/// An index implements `Index<S>` only for the plaintext types `S` that
192
+
/// its operators accept. An index on any other type does not compile. For
193
+
/// example, there is no `Index<u32>` for [`Match`](struct@Match), because
194
+
/// a match query needs text.
195
+
///
196
+
/// An order index ([`Ore`], [`Ope`], or [`OreBlock`]) implements
197
+
/// `Index<S>` for the types that the ordering operators accept
198
+
/// ([`op::Ordered`](crate::op::Ordered)). The order scheme can also order
199
+
/// bytes. No ordering operator accepts bytes, so there is no
198
200
/// `Index<Vec<u8>>` for [`Ore`].
199
201
///
200
202
/// An index does not seal anything. [`indexed`] puts a ciphertext beside the
@@ -206,7 +208,7 @@ impl fmt::Display for IndexSpec {
206
208
#[diagnostic::on_unimplemented(
207
209
message = "`{Self}` is not an index of `{S}`",
208
210
label = "this index is not defined over `{S}`",
209
-
note = "an index applies only to the plaintexts it answers a query over: `Match` takes text, `Equality` takes the types its scheme encodes, and `Ore`, `Ope` and `OreBlock` take the types `op::Ordered` lists"
211
+
note = "`Match` accepts text; `Equality` accepts the types its scheme encodes; `Ore`, `Ope` and `OreBlock` accept the types that implement `op::Ordered`"
210
212
)]
211
213
pubtraitIndex<S>{
212
214
/// The term this index derives.
@@ -231,14 +233,17 @@ pub trait Index<S> {
231
233
pubstructEquality;
232
234
233
235
/// The order-revealing index: a CLLW ORE ciphertext of the value, under a
234
-
/// key derived from the field's context. Defined for every `S` an ordering
235
-
/// operator is answered over ([`op::Ordered`](crate::op::Ordered)): the
236
-
/// integers of 16 bits and wider, the floats, text, dates, timestamps and
237
-
/// decimals.
236
+
/// key derived from the field's context.
237
+
///
238
+
/// `Ore` accepts every type `S` that the ordering operators accept
239
+
/// ([`op::Ordered`](crate::op::Ordered)): the integers of 16 bits and
240
+
/// wider, the floats, text, dates, timestamps, and decimals.
241
+
///
242
+
/// `Ore` does not accept bytes. The scheme can order a `Vec<u8>`, but no
243
+
/// ordering operator accepts bytes.
238
244
///
239
-
/// Not for bytes. The scheme can order a `Vec<u8>`, but no ordering
240
-
/// operator is answered over bytes, so a stored term would reveal the order
241
-
/// of the rows and answer no query. An order index on bytes does not
245
+
/// A stored term of bytes would reveal the order of the rows. No query
246
+
/// could use that term. An order index on bytes therefore does not
0 commit comments