Skip to main content

AppStarter

Struct AppStarter 

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

The lifecycle builder (Java AutoStart/AppStarter, explicit-registration form). Build the application declaratively, then run it:

AppStarter::new()
    .before_application(5, Arc::new(CompileCheck))
    .preload("greeting.demo", TypedAdapter::arc(Greetings), 10)
    .main_application(1, Arc::new(MainApp))
    .run(std::env::args().collect())
    .await?;

Implementations§

Source§

impl AppStarter

Source

pub fn new() -> Self

Source

pub fn before_application( self, sequence: u32, hook: Arc<dyn EntryPoint>, ) -> Self

Register a before-application hook (Java @BeforeApplication). sequence orders execution (lower first, clamped to 999; 0 is reserved for the framework’s essential services — user code uses 1–999, conventionally 3–999).

Source

pub fn preload( self, route: &str, function: Arc<dyn ComposableFunction>, instances: usize, ) -> Self

Register a composable function at startup (Java @PreLoad).

Source

pub fn preload_with_options( self, route: &str, function: Arc<dyn ComposableFunction>, instances: usize, options: FunctionOptions, ) -> Self

Register a composable function with explicit options (Java @PreLoad combined with @ZeroTracing and/or @EventInterceptor).

Source

pub fn main_application(self, sequence: u32, entry: Arc<dyn EntryPoint>) -> Self

Register a main application (Java @MainApplication); sequence orders execution when there is more than one (lower first).

Source

pub async fn run(self, args: Vec<String>) -> Result<(), AppError>

Run the lifecycle (Java AutoStart.mainAppStarter.main). Must be called within a Tokio runtime.

Trait Implementations§

Source§

impl Default for AppStarter

Source§

fn default() -> Self

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

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

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

Source§

fn vzip(self) -> V