Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin:
    Send
    + Sync
    + Sized
    + 'static {
    type Requires;
    type UserFields: Fields;
    type SessionFields: Fields;

    const ID: &'static str;

    // Provided methods
    fn schema(&self, schema: &mut SchemaBuilder) { ... }
    fn init<D: Adapter>(self: &Arc<Self>, app: &mut PluginBuilder<'_, D>) { ... }
}
Expand description

A fastauth plugin. See docs/reference/01-plugin-authoring.md.

Required Associated Constants§

Source

const ID: &'static str

Unique id, used in error messages, schema ownership and derived keys.

Required Associated Types§

Source

type Requires

Plugins that must be registered before this one, as a tuple: (), (Organization,).

Source

type UserFields: Fields

Columns this plugin adds to user; () for none.

Source

type SessionFields: Fields

Columns this plugin adds to session; () for none.

Provided Methods§

Source

fn schema(&self, schema: &mut SchemaBuilder)

Adds tables (schema.model::<M>()) or columns. UserFields and SessionFields are added automatically.

Source

fn init<D: Adapter>(self: &Arc<Self>, app: &mut PluginBuilder<'_, D>)

Registers endpoints, hooks, gates, resolvers, events, rate limits and error codes. Runs once, inside .build().

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§