Skip to main content

Cacheable

Derive Macro Cacheable 

Source
#[derive(Cacheable)]
{
    // Attributes available to this derive:
    #[cacheable]
}
Expand description

Derive macro for sassi::Cacheable.

Generates:

  1. A companion {StructName}Fields struct with one sassi::Field<Self, FieldType> per declared field.
  2. impl sassi::Cacheable for {StructName} with:
    • Id = the type of the field literally named id.
    • fields() trait method wiring every accessor to its real extractor (so generic T: Cacheable callers can construct wired Fields without knowing the concrete type).
  3. When #[cacheable(watermark_field = "...")] is present, an impl sassi::DeltaSyncCacheable whose Watermark is the named field’s type and whose watermark() clones that field.

Requirements:

  • Input must be a struct with named fields.
  • One of the fields must be literally named id.
  • id’s type must implement Hash + Eq + Clone + Ord + Send + Sync + 'static.
  • watermark_field, when present, must name a field whose type implements sassi::MonotonicWatermark.