com_croftsoft_core/role/
mod.rs

1// =============================================================================
2//! - Traits that define roles
3//!
4//! # Metadata
5//! - Copyright: © 2003 - 2022 [`CroftSoft Inc`]
6//! - Author: [`David Wallace Croft`]
7//! - Rust version: 2022-10-09
8//! - Rust since: 2022-10-09
9//! - Java version: 2003-04-09
10//!
11//! # History
12//! - Adapted from the Java interfaces in package com.croftsoft.core.role
13//!   - In the Java-based [`CroftSoft Core Library`]
14//!
15//! [`CroftSoft Core Library`]: https://www.croftsoft.com/library/code/
16//! [`CroftSoft Inc`]: https://www.croftsoft.com/
17//! [`David Wallace Croft`]: https://www.croftsoft.com/people/david/
18// =============================================================================
19
20#[cfg(test)]
21mod test;
22
23/// Determines whether an item should be filtered
24pub trait Filter<I> {
25  /// Filtrate is what passes through a filter
26  fn is_filtrate(
27    &self,
28    item: I,
29  ) -> bool;
30}
31
32/// A generic trait for request processors
33pub trait Server<R, S> {
34  /// Processes a request and returns a response
35  fn serve(
36    &self,
37    request: R,
38  ) -> S;
39}