pub trait HostExternalStorage<Profile, Schema>:
Send
+ Sync
+ 'staticwhere
Profile: HostProfile,
Schema: HostExternalSchema,{
type Payload: 'static;
// Required methods
fn store(
stores: &Profile::ExternalStores,
) -> &HostExternalStore<Self::Payload>;
fn source_equal(
context: &HostExternalEquality<'_>,
left: &Self::Payload,
right: &Self::Payload,
) -> bool;
fn source_hash(
context: &HostExternalHashing<'_>,
value: &Self::Payload,
) -> u64;
fn inspect(
context: &HostExternalInspection<'_>,
value: &Self::Payload,
) -> EcoString;
}Expand description
Provider-owned storage and Gleam source semantics for one external schema.
Payloads are immutable after creation. Values that compare equal through
HostExternalStorage::source_equal must return the same
HostExternalStorage::source_hash. Hash collisions are allowed and are
resolved through source equality. Source hashes are runtime indexes, not
stable serialized values.
Required Associated Types§
Required Methods§
Sourcefn store(stores: &Profile::ExternalStores) -> &HostExternalStore<Self::Payload>
fn store(stores: &Profile::ExternalStores) -> &HostExternalStore<Self::Payload>
Projects the typed payload store from the final profile’s external stores.
Sourcefn source_equal(
context: &HostExternalEquality<'_>,
left: &Self::Payload,
right: &Self::Payload,
) -> bool
fn source_equal( context: &HostExternalEquality<'_>, left: &Self::Payload, right: &Self::Payload, ) -> bool
Compares two payloads using Gleam source equality.
Sourcefn source_hash(context: &HostExternalHashing<'_>, value: &Self::Payload) -> u64
fn source_hash(context: &HostExternalHashing<'_>, value: &Self::Payload) -> u64
Hashes a payload consistently with HostExternalStorage::source_equal.
Sourcefn inspect(
context: &HostExternalInspection<'_>,
value: &Self::Payload,
) -> EcoString
fn inspect( context: &HostExternalInspection<'_>, value: &Self::Payload, ) -> EcoString
Produces the payload’s canonical source-oriented inspection.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".