Struct Initiator

Source
pub struct Initiator<'a, A, L, S>{ /* private fields */ }
Expand description

Socket implementation of establishing connections handler.

Implementations§

Source§

impl<'a, A, L, S> Initiator<'a, A, L, S>

Source

pub fn try_new( settings: &SessionSettings, application: &'a Application<'_, A>, store_factory: &'a S, log_factory: &'a LogFactory<'_, L>, server_mode: FixSocketServerKind, ) -> Result<Self, QuickFixError>

Try create new struct from its mandatory components.

Examples found in repository?
examples/fix_repl/main.rs (lines 32-38)
14fn main() -> Result<(), QuickFixError> {
15    let args: Vec<_> = env::args().collect();
16    let (Some(connect_mode), Some(config_file)) = (args.get(1), args.get(2)) else {
17        eprintln!(
18            "Bad program usage: {} [acceptor|initiator] <config_file>",
19            args[0]
20        );
21        exit(1);
22    };
23
24    println!(">> Creating resources");
25    let settings = SessionSettings::try_from_path(config_file)?;
26    let store_factory = FileMessageStoreFactory::try_new(&settings)?;
27    let log_factory = LogFactory::try_new(&StdLogger::Stdout)?;
28    let callbacks = MyApplication::new();
29    let app = Application::try_new(&callbacks)?;
30
31    match connect_mode.as_str() {
32        "initiator" => server_loop(Initiator::try_new(
33            &settings,
34            &app,
35            &store_factory,
36            &log_factory,
37            FixSocketServerKind::SingleThreaded,
38        )?),
39        "acceptor" => server_loop(Acceptor::try_new(
40            &settings,
41            &app,
42            &store_factory,
43            &log_factory,
44            FixSocketServerKind::SingleThreaded,
45        )?),
46        _ => {
47            eprintln!("Invalid connection mode");
48            exit(1);
49        }
50    }?;
51
52    println!(">> All cleared. Bye !");
53    Ok(())
54}

Trait Implementations§

Source§

impl<A, L, S> ConnectionHandler for Initiator<'_, A, L, S>

Source§

fn start(&mut self) -> Result<(), QuickFixError>

Start handler.
Source§

fn block(&mut self) -> Result<(), QuickFixError>

Block handler.
Source§

fn poll(&mut self) -> Result<bool, QuickFixError>

Poll handler.
Source§

fn stop(&mut self) -> Result<(), QuickFixError>

Stop handler.
Source§

fn is_logged_on(&self) -> Result<bool, QuickFixError>

Check if handler has sent logging message or not.
Source§

fn is_stopped(&self) -> Result<bool, QuickFixError>

Check if handler is currently working or not.
Source§

impl<'a, A, L, S> Debug for Initiator<'a, A, L, S>

Source§

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

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

impl<A, L, S> Drop for Initiator<'_, A, L, S>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<A, L, S> SessionContainer for Initiator<'_, A, L, S>

Source§

fn session(&self, session_id: SessionId) -> Result<Session<'_>, QuickFixError>

Borrow mutable session to the container. Read more

Auto Trait Implementations§

§

impl<'a, A, L, S> Freeze for Initiator<'a, A, L, S>

§

impl<'a, A, L, S> RefUnwindSafe for Initiator<'a, A, L, S>

§

impl<'a, A, L, S> !Send for Initiator<'a, A, L, S>

§

impl<'a, A, L, S> !Sync for Initiator<'a, A, L, S>

§

impl<'a, A, L, S> Unpin for Initiator<'a, A, L, S>

§

impl<'a, A, L, S> UnwindSafe for Initiator<'a, A, L, S>

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, 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 = Infallible

The type returned in the event of a conversion error.
Source§

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

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.