[][src]Struct jupiter::builder::Builder

pub struct Builder { /* fields omitted */ }

Initializes the framework by creating and initializing all core components.

As Jupiter provides a bunch of components of which some are optional, the actual setup can be configured here.

Example

Setting up the framework with all features enabled:

#[tokio::main]
fn main() {
    // Enable all features and build the platform...
    let platform = Builder::new().enable_all().build();

    // Register custom functions here...
     
    // Start the main event loop of the server...
    platform.require::<Server>().event_loop().await;
}

Implementations

impl Builder[src]

pub fn new() -> Self[src]

Creates a new builder.

pub fn enable_all(self) -> Self[src]

Enables all features.

Note that using this method (and then maybe disabling selected components) is quote convenient, but be aware that new components which might be added in a library update will then also be enabled by default. This might or might not be the expected behaviour.

pub fn enable_logging(self) -> Self[src]

Enables the automatic setup of the logging system.

Using this, we properly initialize simplelog to log to stdout. As we intend Jupiter to be run in docker containers, this is all that is needed for proper logging. The date format being used is digestible by established tools like greylog.

pub fn disable_logging(self) -> Self[src]

Disables the automatic setup of the logging system after enable_all() has been used.

pub fn enable_signals(self) -> Self[src]

Installs a signal listener which terminates the framework once CTRL-C or SIGHUP is received.

For more details see: signals

pub fn disable_signals(self) -> Self[src]

Disables installing the signal listener after enable_all() has been used.

pub fn enable_ping_command(self) -> Self[src]

Installs a simple command named PING which simply responds with PONG.

This is used by redis-cli for throughput measurements and health checks.

pub fn disable_ping_command(self) -> Self[src]

Disables installing the PING command after enable_all() has been used.

pub fn enable_core_commands(self) -> Self[src]

Installs a bunch of health and maintenance commands.

For more details see: core

pub fn disable_core_commands(self) -> Self[src]

Disables installing the core commands after enable_all() has been used.

pub fn enable_config(self) -> Self[src]

Installs config::Config and loads the settings.yml.

For more details see: config

pub fn disable_config(self) -> Self[src]

Disables setting up a Config instance after enable_all() has been used.

pub fn enable_commands(self) -> Self[src]

Creates and installs a Commands dispatcher.

For more details see: Commands

pub fn disable_commands(self) -> Self[src]

Disables setting up a Commands instance after enable_all() has been used.

pub fn enable_server(self) -> Self[src]

Creates and installs a Server instance.

For more details see: server. Note that still, the main event loop has to be invoked manually via: platform.require::<Server>().event_loop().await.

pub fn disable_server(self) -> Self[src]

Disables setting up a Server instance after enable_all() has been used.

pub fn build(self) -> Arc<Platform>[src]

Builds the Platform registry with all the enabled components being registered.

Auto Trait Implementations

impl RefUnwindSafe for Builder

impl Send for Builder

impl Sync for Builder

impl Unpin for Builder

impl UnwindSafe for Builder

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> From<T> for T[src]

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

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.