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

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]
async fn main() {
    // Enable all features and build the platform...
    let platform = Builder::new().enable_all().build().await;

    // Register custom functions here...
     
    // Start the main event loop of the server...
    platform.require::<Server<RespPayload>>().event_loop(&resp_protocol_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_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 CommandDictionary.

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 async fn build(self) -> Arc<Platform>[src]

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

Trait Implementations

impl Default for Builder[src]

fn default() -> Builder[src]

Returns the “default value” for a type. Read more

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

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

Performs the conversion.