Struct preroll::VariadicRoutes[][src]

pub struct VariadicRoutes<State> where
    State: Send + Sync + 'static, 
{ pub routes: Vec<Box<dyn Fn(Route<'r, Arc<State>>)>>, // some fields omitted }

Variadic-argument route versioning is implemented via this struct for From<T> with Single-argument, Tuple, and Vec types.

This allows preroll::main! and preroll::test_utils::create_client to version routes automatically based on their position in the arguments list.

Examples of what can be provided to any function that accepts impl Into<VariadicRoutes>, assuming all arguments are Fn(Route<'r, Arc<State>>):

  • A single routes function argument.
    • Will become /api/v1.
    • E.g. routes_v1 or routes_setup.
  • A Tuple of 1 to 4 routes functions.
    • Will become /api/v1 through /api/v4.
    • E.g. (routes_v1, routes_v2, routes_v3)
  • A Vec of boxed routes functions.
    • If you need this you may want to reconsider your architecture!
    • Will become /api/v{N} where N is the index + 1.
    • E.g. vec![Box::new(routes_v1), Box::new(routes_v2)]

Fields

routes: Vec<Box<dyn Fn(Route<'r, Arc<State>>)>>

Trait Implementations

impl<State, RoutesFn> From<(RoutesFn,)> for VariadicRoutes<State> where
    State: Send + Sync + 'static,
    RoutesFn: for<'r> Fn(Route<'r, Arc<State>>) + Debug + 'static, 
[src]

impl<State, RoutesFn1, RoutesFn2, RoutesFn3, RoutesFn4> From<(RoutesFn1, RoutesFn2, RoutesFn3, RoutesFn4)> for VariadicRoutes<State> where
    State: Send + Sync + 'static,
    RoutesFn1: for<'r> Fn(Route<'r, Arc<State>>) + 'static,
    RoutesFn2: for<'r> Fn(Route<'r, Arc<State>>) + 'static,
    RoutesFn3: for<'r> Fn(Route<'r, Arc<State>>) + 'static,
    RoutesFn4: for<'r> Fn(Route<'r, Arc<State>>) + 'static, 
[src]

impl<State, RoutesFn1, RoutesFn2, RoutesFn3> From<(RoutesFn1, RoutesFn2, RoutesFn3)> for VariadicRoutes<State> where
    State: Send + Sync + 'static,
    RoutesFn1: for<'r> Fn(Route<'r, Arc<State>>) + 'static,
    RoutesFn2: for<'r> Fn(Route<'r, Arc<State>>) + 'static,
    RoutesFn3: for<'r> Fn(Route<'r, Arc<State>>) + 'static, 
[src]

impl<State, RoutesFn1, RoutesFn2> From<(RoutesFn1, RoutesFn2)> for VariadicRoutes<State> where
    State: Send + Sync + 'static,
    RoutesFn1: for<'r> Fn(Route<'r, Arc<State>>) + 'static,
    RoutesFn2: for<'r> Fn(Route<'r, Arc<State>>) + 'static, 
[src]

impl<State, RoutesFn> From<RoutesFn> for VariadicRoutes<State> where
    State: Send + Sync + 'static,
    RoutesFn: for<'r> Fn(Route<'r, Arc<State>>) + 'static, 
[src]

impl<State> From<Vec<Box<dyn Fn(Route<'r, Arc<State>>) + 'static, Global>, Global>> for VariadicRoutes<State> where
    State: Send + Sync + 'static, 
[src]

Auto Trait Implementations

impl<State> !RefUnwindSafe for VariadicRoutes<State>

impl<State> !Send for VariadicRoutes<State>

impl<State> !Sync for VariadicRoutes<State>

impl<State> Unpin for VariadicRoutes<State>

impl<State> !UnwindSafe for VariadicRoutes<State>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<D> OwoColorize for D

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]