labstream_core/lib.rs
1//! The LSL core library, as one crate.
2//!
3//! This crate holds no code of its own. It names the four crates that carry
4//! the library, so a program takes one dependency and not four:
5//!
6//! ```toml
7//! [dependencies]
8//! labstream-core = "0.1"
9//! ```
10//!
11//! Each crate stays separate below this one. A program that wants one part
12//! alone can still name that part alone.
13//!
14//! # The parts
15//!
16//! | Module | Crate | Touches the operating system |
17//! |---|---|---|
18//! | [`wire`] | `labstream-wire` | no |
19//! | [`proto`] | `labstream-proto` | no |
20//! | [`time`] | `labstream-time` | no |
21//! | [`net`] | `labstream-net` | yes |
22//!
23//! # The C ABI is not here
24//!
25//! `labstream-capi` builds `liblsl.so` for a C program. It gives a Rust
26//! program nothing, so this crate does not name it. `README.md` gives the way
27//! to build it.
28//!
29//! # Features
30//!
31//! `net` is on by default. It carries the one crate that opens a socket. A
32//! program that reads bytes from somewhere else can turn it off:
33//!
34//! ```toml
35//! [dependencies]
36//! labstream-core = { version = "0.1", default-features = false }
37//! ```
38//!
39//! `wire`, `proto`, and `time` hold no input and no output, so they cost a
40//! program nothing and stay present.
41//!
42//! # An example
43//!
44//! ```no_run
45//! use labstream_core::net::{clock, Outlet, StreamInfo};
46//! use labstream_core::wire::{Format, Sample, Value};
47//!
48//! # fn main() -> std::io::Result<()> {
49//! let info = StreamInfo::new("BioSemi", "EEG", 8, Format::Float32, 100.0);
50//! let outlet = Outlet::new(info)?;
51//! outlet.push(&Sample {
52//! timestamp: clock(),
53//! values: (0..8).map(|k| Value::F32(k as f32)).collect(),
54//! });
55//! # Ok(())
56//! # }
57//! ```
58
59#![forbid(unsafe_code)]
60#![deny(missing_docs)]
61
62/// The handshake, the discovery messages, and the time sync. No input and no
63/// output.
64pub use labstream_proto as proto;
65/// The timestamp filter. The result matches the C++ filter bit for bit.
66pub use labstream_time as time;
67/// The sample codec for protocol 1.10. No input and no output.
68pub use labstream_wire as wire;
69
70/// Sockets, outlet, inlet, resolver, configuration, and XPath.
71///
72/// This is the one part that touches the operating system. The `net` feature
73/// carries it, and that feature is on by default.
74#[cfg(feature = "net")]
75pub use labstream_net as net;