arcature 0.1.1

Arcature: an opinionated full-stack Rust web framework. One package, batteries included.
Documentation
//! `RequestCacheDescriptor` -- compile-time metadata for a `#[request_cache]`
//! resolver.
//!
//! A sibling to `AuthUser`: this is the *compile-time* contract the
//! `#[request_cache]` proc-macro generates against. This descriptor is pure
//! data -- a `&'static` const describing which resolvers are memoized, and
//! readable without running the application.
//!
//! Nothing reads it yet. `ModuleDescriptor` has no field for request caches,
//! so the descriptor does not reach the Unified Application Graph and no
//! command reports on it. That is worth stating plainly rather than naming a
//! consumer that does not exist: the value here is the compile-time contract
//! the macro checks against, and a reporting surface is still to be built.
//!
//! # No runtime here
//!
//! This module carries NO runtime behavior -- no memoization, no locking.
//! It is metadata only, matching the one-file-one-responsibility law: the
//! descriptor (this file) is separate from the store that does the
//! remembering, which lives next door in
//! [`request_cache_store`](super::request_cache_store). Tooling that only
//! needs to *report* which resolvers are memoized reads this file and never
//! touches the store.
//!
//! # Example
//!
//! ```
//! // Generated by `#[request_cache]` in arcature-macros:
//! pub const LOAD_PROFILE_REQUEST_CACHE: ::arcature::RequestCacheDescriptor =
//!     ::arcature::RequestCacheDescriptor {
//!         name: "load_profile",
//!         key_fields: &["user_id"],
//!     };
//!
//! // Pure data, readable without running the application -- which is the
//! // whole claim this module makes.
//! assert_eq!(LOAD_PROFILE_REQUEST_CACHE.key_fields, &["user_id"]);
//! ```

/// Compile-time metadata for a per-request memoized resolver.
///
/// The `#[request_cache]` proc-macro generates a `pub const <NAME>_REQUEST_CACHE:
/// RequestCacheDescriptor` for each annotated resolver. The descriptor records
/// the resolver's name and the names of the parameters that form its cache key,
/// so the UAG / Inspector can show "this resolver is memoized per request by
/// `<key_fields>`" without running the resolver.
///
/// The fields are `&'static` so the descriptor is `const`-constructible and
/// lives in the binary (no allocation). A descriptor is *declarative* -- it
/// does not cause memoization; the wrapper the macro generates around the
/// resolver does, against
/// [`RequestCache`](super::request_cache_store::RequestCache). The
/// descriptor is what the graph records.
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize)]
pub struct RequestCacheDescriptor {
    /// The resolver's name (typically the function name).
    pub name: &'static str,
    /// The names of the parameters that form the cache key, in declaration
    /// order. A single-field key is the common case; a composite key lists
    /// each constituent field name.
    pub key_fields: &'static [&'static str],
}