pub trait FilterableValue: Serialize + Private {
type Column;
}Expand description
Types which can appear as an argument to an index filtering operation
for a column of type Column.
Types which can appear specifically as a terminating bound in a BTree index,
which may be a range, instead use IndexScanRangeBoundsTerminator.
Because SpacetimeDB supports a only restricted set of types as index keys,
only a small set of Column types have corresponding FilterableValue implementations.
Specifically, these types are:
- Signed and unsigned integers of various widths.
bool.String, which is also filterable with&str.Identity.ConnectionId.Hash.- No-payload enums annotated with
#[derive(SpacetimeType)]. No-payload enums are sometimes called “plain,” “simple” or “C-style.” They are enums where no variant has any payload data.
Because SpacetimeDB indexes are present both on the server
and in clients which use our various SDKs,
implementing FilterableValue for a new column type is a significant burden,
and is not as simple as adding a new impl FilterableValue block to our Rust code.
To implement FilterableValue for a new column type, you must also:
- Ensure (with automated tests) that the
spacetimedb-codegencrate and accompanying SpacetimeDB client SDK can equality-compare and ordering-compare values of the column type, and that the resulting ordering is the same as the canonical ordering implemented byspacetimedb-satsforspacetimedb_sats::AlgebraicValue. This will nearly always require implementing bespoke comparison methods for the type in question, as most languages do not automatically make product types (structs or classes) sortable. - Extend our other supported module languages’ bindings libraries. so that they can also define tables with indexes keyed by the new filterable type.
Required Associated Types§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.