Skip to main content

ManyToManyAdapter

Trait ManyToManyAdapter 

Source
pub trait ManyToManyAdapter: Send + Sync {
    // Required methods
    fn fetch_options<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>, AdminError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn fetch_selected<'life0, 'life1, 'async_trait>(
        &'life0 self,
        record_id: &'life1 Value,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, AdminError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn save<'life0, 'life1, 'async_trait>(
        &'life0 self,
        record_id: &'life1 Value,
        selected_ids: Vec<String>,
    ) -> Pin<Box<dyn Future<Output = Result<(), AdminError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Handles the options list and junction-table read/write for a ManyToMany field.

Required Methods§

Source

fn fetch_options<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>, AdminError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

All available options as (value, label) pairs.

Source

fn fetch_selected<'life0, 'life1, 'async_trait>( &'life0 self, record_id: &'life1 Value, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, AdminError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The currently selected IDs for a given record.

Source

fn save<'life0, 'life1, 'async_trait>( &'life0 self, record_id: &'life1 Value, selected_ids: Vec<String>, ) -> Pin<Box<dyn Future<Output = Result<(), AdminError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Replace the current selection for a record (delete + insert in the junction table).

Implementors§