Struct BlackBoard

Source
pub struct BlackBoard<'a, Section: Hash + Eq, Type> { /* private fields */ }
Expand description

Represents a blackboard where processes can post and get items in sections, and also subscribe for changes in a specific section.

Implementations§

Source§

impl<'a, Section, Type> BlackBoard<'a, Section, Type>
where Section: Hash + Eq,

Source

pub fn new() -> Self

Generates a new, empty blackboard

Source

pub fn get(&self, section: &Section) -> Option<&Vec<Type>>

Gets the section, if it exists.

Source

pub fn get_sections(&self) -> Vec<&Section>

Returns a list of all the sections present right now in the BlackBoard

Source

pub fn post(&mut self, section: Section, what: Type)

Posts data on the desired section. Note that data is consumed

Source

pub fn subscribe( &mut self, section: Section, subscriptor: impl Subscriptor<Type> + 'a, )

Suscribes a function to the specified section. When a post to that section occurs, the function passed in is called with the newly posted value as argument

Source

pub fn subscribe_rc( &mut self, section: Section, subscriptor: &Rc<impl Subscriptor<Type> + 'a>, )

Trait Implementations§

Source§

impl<'a, Section, Type> Drop for BlackBoard<'a, Section, Type>
where Section: Hash + Eq,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a, Section, Type> Freeze for BlackBoard<'a, Section, Type>

§

impl<'a, Section, Type> !RefUnwindSafe for BlackBoard<'a, Section, Type>

§

impl<'a, Section, Type> !Send for BlackBoard<'a, Section, Type>

§

impl<'a, Section, Type> !Sync for BlackBoard<'a, Section, Type>

§

impl<'a, Section, Type> Unpin for BlackBoard<'a, Section, Type>
where Section: Unpin, Type: Unpin,

§

impl<'a, Section, Type> !UnwindSafe for BlackBoard<'a, Section, Type>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.