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