pub struct Contributions {Show 14 fields
pub resources: Vec<Resource>,
pub settings: Vec<SettingsItem>,
pub permissions: Vec<Permission>,
pub picker_sources: Vec<PickerSourceReg>,
pub persisters: Vec<PersisterReg>,
pub listeners: Vec<ModelListenerReg>,
pub field_types: Vec<FieldTypeReg>,
pub column_types: Vec<ColumnTypeReg>,
pub icons: Vec<(ModuleId, IconReg)>,
pub screens: Vec<ScreenReg>,
pub public_routes: Vec<PublicRouteReg>,
pub nav: Vec<NavItem>,
pub resource_hooks: Vec<ResourceHook>,
pub plugin_defined: Arc<Registry>,
}Expand description
Builds the admin router. app_resources are the application’s own list/form
screens; app_settings are its settings models; app_permissions are the
permissions it defines, offered in the role editor alongside the framework’s.
All are mounted alongside the framework’s built-in equivalents.
Everything the modules and the application contribute to the admin, in one
value.
Build it with the fields you mean and leave the rest to Default:
let contributions = Contributions {
permissions: Vec::new(),
..Default::default()
};It exists so that a new kind of contribution is a new field rather than a new
argument. The nine of them were positional before, and a run of interchangeable
Vec::new() placeholders is a mistake the compiler cannot catch: swap two and
it still builds. Naming them removes that whole class of error, and ending a
literal with ..Default::default() means a later field does not break the
call.
Fields§
§resources: Vec<Resource>List and form screens, mounted beside the framework’s own.
settings: Vec<SettingsItem>Settings models, offered in the settings area.
permissions: Vec<Permission>Permissions defined by the application, offered in the role editor.
picker_sources: Vec<PickerSourceReg>Sources a reference field searches and resolves against.
persisters: Vec<PersisterReg>Named write handlers a form can select.
listeners: Vec<ModelListenerReg>Listeners run around every save and delete.
field_types: Vec<FieldTypeReg>Column types a list cell can render through. Field types a module contributes, offered to every form and settings screen beside the built-ins.
column_types: Vec<ColumnTypeReg>§icons: Vec<(ModuleId, IconReg)>Icons a module contributes, for glyphs the framework’s curated set does not carry. Each is namespaced to the contributing module.
screens: Vec<ScreenReg>Screens a module mounts itself, for anything that is not a list or form.
public_routes: Vec<PublicRouteReg>Routes mounted outside the admin, at literal paths.
Menu entries and sections beyond what resources and screens add for
themselves. See nav::NavItem.
resource_hooks: Vec<ResourceHook>Changes to other modules’ resources, applied before they mount. See
ResourceHook.
plugin_defined: Arc<Registry>Everything the framework itself does not consume: the contribution types
modules define for each other. Kept whole so a contributed route can read
them through routes::RouteCtx::contributions, which is what makes a
module’s own extension point usable by another module.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Contributions
impl !UnwindSafe for Contributions
impl Freeze for Contributions
impl Send for Contributions
impl Sync for Contributions
impl Unpin for Contributions
impl UnsafeUnpin for Contributions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more