eventp 1.0.0

Safe Rust abstraction over Linux epoll, offering a truly zero-cost event dispatch mechanism.
Documentation
//! A mock implementation of `EventpOps` generated by [mockall].
//! See the [mockall] documentation for more information.
//!
//! # Examples
//!
//! ```rust
//! use mockall::predicate;
//! use eventp::{interest, EventpOps, mock::MockEventp};
//!
//! // Create a new mock object.
//! let mut mock = MockEventp::new();
//!
//! // Set an expectation for the `modify` method.
//! // It expects to be called exactly once with fd=5 and EPOLLIN.
//! // When called, it will return Ok(()).
//! mock.expect_modify()
//!     .with(predicate::eq(5), predicate::eq(interest().read()))
//!     .times(1)
//!     .returning(|_fd, _interest| Ok(()));
//!
//! // Call the method. This will be checked against the expectation.
//! let result = mock.modify(5, interest().read());
//!
//! // Assert that the call was successful.
//! assert!(result.is_ok());
//!
//! // When `mock` goes out of scope at the end of this block, mockall will
//! // verify that all expectations were met (e.g., that `modify` was called exactly once).
//! ```

use std::io;
use std::os::fd::RawFd;

use crate::thin::ThinBoxSubscriber;
use crate::{EventpOps, EventpOpsAdd, Interest};

mockall::mock! {
    /// See [module level docs](self) for more information.
    pub Eventp {}

    impl EventpOpsAdd<Self> for Eventp {
        fn add(&mut self, subscriber: ThinBoxSubscriber<Self>) -> io::Result<()>;
    }

    impl EventpOps for Eventp {
        fn modify(&mut self, fd: RawFd, interest: Interest) -> io::Result<()>;
        fn delete(&mut self, fd: RawFd) -> io::Result<()>;
    }
}