Skip to main content

FeatureFlags

Struct FeatureFlags 

Source
pub struct FeatureFlags { /* private fields */ }
Expand description

Registers the Flags registry into application state.

Adds no routes. There is no first-party screen for switching flags on and off, deliberately: a page that changes what every user of the application sees is one an application has to decide who may open, and shipping one that turns itself on with the plugin would be shipping that decision already made — wrongly.

Implementations§

Source§

impl FeatureFlags

Source

pub fn new(flags: Flags) -> Self

Register a registry the application built.

Source

pub fn from_config(flags: Flags, config: &Config) -> Self

Register it, applying flags.on and flags.off from configuration first.

In .env that is FLAGS_OFF=new-checkout,beta-search, through whatever mapping the application’s configuration uses — which is the point of it: a feature can be switched off by an environment variable and a restart, with no deploy and no working database. See Flags for where the two lists sit in the precedence chain, and why flags.off sits at the top.

Source

pub fn flags(&self) -> &Flags

The registry, for wiring it into anything else that needs one — a console command, a seeder, a test.

Trait Implementations§

Source§

impl Plugin for FeatureFlags

Source§

fn name(&self) -> &'static str

Shown by rustlavel route:list and in boot logs.
Source§

fn register(self: Box<Self>, setup: &mut Setup<'_>)

Add routes, middleware, and state.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.