Expand description
§Actors clients
The module holds the implementation of the different clients that can be assigned to Actors.
Any structure can become a client to an Actor if it implements the Update trait with either or both Read and Write traits.
§Example
§Logging
A simple logger with a single entry:
use gmt_dos_clients::logging::Logging;
let logging = Logging::<f64>::default();A logger with 2 entries and pre-allocated with 1000 elements:
use gmt_dos_clients::logging::Logging;
let logging = Logging::<f64>::default().n_entry(2).capacity(1_000);§Signals
A constant signal for 100 steps
use gmt_dos_clients::signals::{Signals, Signal};
let signal: Signals = Signals::new(1, 100).signals(Signal::Constant(3.14));A 2 outputs signal made of a constant and a sinusoid for 100 steps
use gmt_dos_clients::signals::{Signals, Signal};
let signal: Signals = Signals::new(2, 100)
.output_signal(0, Signal::Constant(3.14))
.output_signal(1, Signal::Sinusoid{
amplitude: 1f64,
sampling_frequency_hz: 1000f64,
frequency_hz: 20f64,
phase_s: 0f64
});§Rate transitionner
A rate transition actor for a named output/input pair sampling a Vec
use gmt_dos_clients::sampler::Sampler;
#[derive(interface::UID)]
enum MyIO {};
let sampler = Sampler::<Vec<f64>, MyIO>::default();§Alias to input/output UID
Creating an alias to an already existing UniqueIdentifier (UID)
use std::sync::Arc;
use interface::{Data, Write, UniqueIdentifier,Size, UID, Update};
// Original UID
#[derive(UID)]
#[uid(data = u8)]
pub enum A {}
pub struct Client {}
impl Update for Client {}
impl Write<A> for Client {
fn write(&mut self) -> Option<Data<A>> {
Some(Data::new(10u8))
}
}
impl Size<A> for Client {
fn len(&self) -> usize {
123
}
}
// A alias with `Write` and `Size` trait implementation for `Client`
#[derive(UID)]
#[uid(data = u8)]
#[alias(name = A, client = Client, traits = Write ,Size)]
pub enum B {}
let _: <A as UniqueIdentifier>::DataType = 1u8;
let _: <B as UniqueIdentifier>::DataType = 2u8;
let mut client = Client {};
println!(
"Client Write<B>: {:?}",
<Client as Write<B>>::write(&mut client)
);
println!(
"Client Size<B>: {:?}",
<Client as Size<B>>::len(&mut client)
);§Features
noise: enable noisy signalsserde: enable serializationgif: enable the gif clientfaer: enable matrix gainnalgebra: enable matrix gain with nalgebra matrix input
Modules§
- average
- fill
- foh
- Fists-order hold
- fun
- gain
- gif
- GIF image encoder
- iir
- Infinite Impulse Response (IIR) filter client
- integrator
- Integrator client
- leftright
- A client that splits vectors in 2 parts
- logging
- low_
pass_ filter - multiplex
- Data multiplexer
- once
- Once Per Read
- operator
- pulse
- sampler
- select
- Select vector element
- signals
- smooth
- timer
Structs§
Enums§
- Tick
- Timer heartbeat identifier