Struct screech::DynamicTracker

source ·
pub struct DynamicTracker<T = ()> { /* private fields */ }
Expand description

Basic dynamically sized tracker for the creation of unique ids and to keep track of signals belonging to a certain id

use screech::traits::Tracker;
use screech::DynamicTracker;

let mut tracker = DynamicTracker::<()>::new(128);

// the resulting id is irrelevant as long as it is unique
assert_eq!(tracker.create_source_id() != tracker.create_source_id(), true);

Implementations§

source§

impl<T> DynamicTracker<T>

source

pub fn new(buffer_size: usize) -> Self

create a new tracker

Trait Implementations§

source§

impl<T> Tracker<T> for DynamicTracker<T>

source§

fn get_buffer_size(&self) -> &usize

return the buffer size
source§

fn create_source_id(&mut self) -> usize

Return a unique ID for keeping track of Sourcees
source§

fn clear_source(&mut self, id: usize)

clear source id and associated buffers
source§

fn get_sources(&self, id: &usize) -> Vec<usize>

get all source ids required for a given source id
source§

fn get_output(&self, o: &Output) -> Option<&Signal>

get a reference to an output’s Signal
source§

fn get_mut_output(&mut self, o: &Output) -> Option<&mut Signal>

get a mutable reference to an output’s Signal
source§

fn init_output(&mut self, o: &Output)

initialize empty Signal for output
source§

fn init_input(&mut self, s: &Input)

initialize input for tracking outputs connected to it
source§

fn get_input(&self, s: &Input) -> Option<&[Output]>

return a reference to a list of outputs for a given input
source§

fn resize_buffers(&mut self, buffer_size: usize)

resize internal buffers
source§

fn connect_signal(&mut self, output: &Output, input: &Input)

connect an Output to an Input
source§

fn clear_connection(&mut self, output: &Output, input: &Input)

clear Output connection from an Input
source§

fn send_message(&mut self, id: &usize, message: Message<T>)

send message to source id
source§

fn get_messages(&self, id: &usize) -> Option<&[Message<T>]>

get all messages for given source id
source§

fn clear_messages(&mut self)

clear all messages for all sources

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for DynamicTracker<T>where T: RefUnwindSafe,

§

impl<T> Send for DynamicTracker<T>where T: Send,

§

impl<T> Sync for DynamicTracker<T>where T: Sync,

§

impl<T> Unpin for DynamicTracker<T>where T: Unpin,

§

impl<T> UnwindSafe for DynamicTracker<T>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.