Skip to main content

MemoryCaller

Trait MemoryCaller 

Source
pub trait MemoryCaller:
    Clone
    + Send
    + Sync
    + 'static {
    // Required method
    fn principal(&self) -> Option<&Id>;
}
Expand description

A caller context the in-repo reference MemoryBackends accept as their JmapAccounts::CallerCtx: anything that names the caller’s Principal, or names none.

Every reference backend in this workspace is generic over one C: MemoryCaller, with Id as the default, and its JmapAccounts::principal_id returns MemoryCaller::principal. A deployment therefore picks one caller type and every family’s memory backend takes it, so one Dispatcher of that type hosts all their handlers.

  • Id: the caller is the Principal with that id. A backend that models per-user rights (sharing, owners, moderators) checks them against it; a single-user backend treats every caller as the account owner.
  • (): a deployment without identity. Every caller acts as the account owner, with all rights.

A production deployment implements its own backends against its own caller type and does not need this trait; it exists so the reference backends agree on one.

Required Methods§

Source

fn principal(&self) -> Option<&Id>

The caller’s Principal id, or None for a deployment without identity, whose every caller acts as the account owner.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl MemoryCaller for ()

A deployment without identity: every caller acts as the account owner.

Source§

fn principal(&self) -> Option<&Id>

Implementors§

Source§

impl MemoryCaller for Id

The caller is the Principal with this id.