Skip to main content

Crate labstream_core

Crate labstream_core 

Source
Expand description

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:

[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

ModuleCrateTouches the operating system
wirelabstream-wireno
protolabstream-protono
timelabstream-timeno
netlabstream-netyes

§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:

[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

use labstream_core::net::{clock, Outlet, StreamInfo};
use labstream_core::wire::{Format, Sample, Value};

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(),
});

Re-exports§

pub use labstream_proto as proto;
pub use labstream_time as time;
pub use labstream_wire as wire;
pub use labstream_net as net;