pub struct FeatureSet { /* private fields */ }Expand description
Collected contributions from one or more plugins.
Implementations§
Source§impl FeatureSet
impl FeatureSet
Sourcepub fn new() -> FeatureSet
pub fn new() -> FeatureSet
Start an empty feature set. By default all known capabilities are allowed
and route names are prefixed with {plugin}..
Sourcepub fn allow(
self,
capabilities: impl IntoIterator<Item = Capability>,
) -> FeatureSet
pub fn allow( self, capabilities: impl IntoIterator<Item = Capability>, ) -> FeatureSet
Restrict which capabilities plugins may use. Unknown declarations fail.
Sourcepub fn namespace_route_names(self, enabled: bool) -> FeatureSet
pub fn namespace_route_names(self, enabled: bool) -> FeatureSet
When true (default), route names become {plugin}.{name}.
Sourcepub fn plugin(self, plugin: impl Plugin) -> Result<FeatureSet, FeatureError>
pub fn plugin(self, plugin: impl Plugin) -> Result<FeatureSet, FeatureError>
Install one plugin. Fails closed on name / capability / contribution conflicts.
§Errors
Returns FeatureError when the plugin is invalid or conflicts with an
already installed plugin.
Sourcepub fn with_middleware<M>(self, middleware: M) -> FeatureSetwhere
M: Middleware,
pub fn with_middleware<M>(self, middleware: M) -> FeatureSetwhere
M: Middleware,
Attach shared middleware to every route contributed so far.
Sourcepub fn into_routes(self) -> Routes
pub fn into_routes(self) -> Routes
Take contributed routes for merging into the application router.
Sourcepub fn merge_into(self, routes: Routes) -> Routes
pub fn merge_into(self, routes: Routes) -> Routes
Merge feature routes into an existing application routes table.
Sourcepub fn into_commands(self) -> Vec<CommandEntry>
pub fn into_commands(self) -> Vec<CommandEntry>
Take console commands for chaining into phoenix_console::Console::commands.
Sourcepub fn into_parts(self) -> FeatureParts
pub fn into_parts(self) -> FeatureParts
Unpack routes, commands, and migrations when the app needs all three.