Skip to main content

EngineBuilder

Struct EngineBuilder 

Source
pub struct EngineBuilder<A: Application = NoOpApplication> { /* private fields */ }
Expand description

Builder for configuring a FIX engine.

Set the Application and add exactly one SessionConfig, then call EngineBuilder::into_initiator or EngineBuilder::into_acceptor to obtain a runnable engine.

Implementations§

Source§

impl EngineBuilder<NoOpApplication>

Source

pub fn new() -> Self

Creates a new engine builder with default settings.

Source§

impl<A: Application + 'static> EngineBuilder<A>

Source

pub fn with_application<B: Application>( self, application: B, ) -> EngineBuilder<B>

Sets the application callback handler.

Source

pub fn add_session(self, config: SessionConfig) -> Self

Adds a session configuration.

The terminal methods build a single-session engine, so exactly one session must be added before EngineBuilder::into_initiator or EngineBuilder::into_acceptor is called.

Source

pub fn with_connect_timeout(self, timeout: Duration) -> Self

Sets the TCP connect timeout used by EngineBuilder::into_initiator (default 30s). It has no effect on an acceptor.

Source

pub fn sessions(&self) -> &[SessionConfig]

Returns the configured sessions.

Source

pub const fn connect_timeout(&self) -> Duration

Returns the connection timeout.

Source

pub fn application(&self) -> Arc<A> ⓘ

Returns the application handler.

Source

pub fn into_initiator(self) -> Result<Initiator<A>, EngineError>

Consumes the builder and produces a client-side Initiator for the single configured session, applying the configured connect timeout.

§Errors

Returns EngineError::Configuration unless exactly one session has been added.

Source

pub fn into_acceptor(self) -> Result<Acceptor<A>, EngineError>

Consumes the builder and produces a server-side Acceptor for the single configured session.

§Errors

Returns EngineError::Configuration unless exactly one session has been added.

Trait Implementations§

Source§

impl<A: Debug + Application> Debug for EngineBuilder<A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EngineBuilder<NoOpApplication>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<A> Freeze for EngineBuilder<A>
where Arc<A>: Freeze,

§

impl<A> RefUnwindSafe for EngineBuilder<A>
where Arc<A>: RefUnwindSafe,

§

impl<A> Send for EngineBuilder<A>
where Arc<A>: Send,

§

impl<A> Sync for EngineBuilder<A>
where Arc<A>: Sync,

§

impl<A> Unpin for EngineBuilder<A>
where Arc<A>: Unpin,

§

impl<A> UnsafeUnpin for EngineBuilder<A>
where Arc<A>: UnsafeUnpin,

§

impl<A> UnwindSafe for EngineBuilder<A>
where Arc<A>: UnwindSafe,

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

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

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more