roopes-core 0.1.1

Roopes is a Rust Object Oriented Pattern Element System. This crate provides generic traits and implementations for typical object-oriented patterns in Rust. It is intended to be used as a cluster of utility classes for implementing OOP-architected executables -- in Rust!
Documentation
//! This module enables conversion between [`Observer`] and [`Executable`].
#[cfg(test)]
mod tests;

use crate::prelude::*;

/// Wraps an [`Observer`] such that calls to [`Executable::execute`] are
/// forwarded to [`Observer::notify`].
pub struct ExecutableObserver<O>
where
    O: Observer,
{
    delegate: O,
}

impl<O> Observer for ExecutableObserver<O>
where
    O: Observer,
{
    fn notify(&self)
    {
        self.delegate.notify();
    }
}

impl<O> Executable for ExecutableObserver<O>
where
    O: Observer,
{
    fn execute(&self)
    {
        self.delegate.notify();
    }
}

/// Provides types which are exposed at the
/// library level.
pub mod prelude
{
    pub use super::ExecutableObserver;
}