spectator/
lib.rs

1// Copyright 2018-2024 argmin developers
2//
3// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
5// http://opensource.org/licenses/MIT>, at your option. This file may not be
6// copied, modified, or distributed except according to those terms.
7
8//! Spectator is a GUI tool to observe the progress of an optimization run.
9//! The data is transferred to spectator by the argmin observer
10//! [`argmin-observer-spectator`](https://crates.io/crates/argmin-observer-spectator).
11//!
12//! ## Installation
13//!
14//! The preferred way is to install directly from crates.io:
15//!
16//! ```bash
17//! cargo install spectator --locked
18//! ```
19//!
20//! Alternatively, one can clone the repo and install/run from there:
21//!
22//! ```bash
23//! git clone https://github.com/argmin-rs/argmin.git
24//! cd argmin
25//!
26//! # Compile and run from the repo...
27//! cargo build -p spectator --release
28//! ./target/release/spectator
29//!
30//! # .. or directly run from the repo...
31//! cargo run -p spectator --release
32//!
33//! # ... or install locally
34//! cargo install -p spectator
35//! spectator
36//! ```
37//!
38//! ## Usage
39//!
40//! ```bash
41//! spectator --host 127.0.0.1 --port 5498
42//! ```
43//!
44//! The optional options `--host` and `--port` indicate the host and port spectator binds to.
45//! By default, spectator will bind to `0.0.0.0:5498`.
46//!
47//! ## Library
48//!
49//! This crate can also be used as a library and exposes the [`Message`] type used to encode data
50//! sent to spectator and [`DEFAULT_PORT`] which defines the default port used by spectator.
51//!
52//! # License
53//!
54//! Licensed under either of
55//!
56//!   * Apache License, Version 2.0,
57//!     ([LICENSE-APACHE](https://github.com/argmin-rs/argmin/blob/main/LICENSE-APACHE) or
58//!     <http://www.apache.org/licenses/LICENSE-2.0>)
59//!   * MIT License ([LICENSE-MIT](https://github.com/argmin-rs/argmin/blob/main/LICENSE-MIT) or
60//!     <http://opensource.org/licenses/MIT>)
61//!
62//! at your option.
63//!
64//! ## Contribution
65//!
66//! Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion
67//! in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above,
68//! without any additional terms or conditions.
69
70#![warn(missing_docs)]
71
72mod message;
73
74pub use message::Message;
75
76/// Default port used by spectator
77pub const DEFAULT_PORT: u16 = 5498;