pub struct EmployeePool {
pub employees: Vec<Employee>,
/* private fields */
}Expand description
Pool of employees with organizational hierarchy support.
Fields§
§employees: Vec<Employee>All employees
Implementations§
Source§impl EmployeePool
impl EmployeePool
Sourcepub fn add_employee(&mut self, employee: Employee)
pub fn add_employee(&mut self, employee: Employee)
Add an employee to the pool.
Sourcepub fn get_by_id_mut(&mut self, employee_id: &str) -> Option<&mut Employee>
pub fn get_by_id_mut(&mut self, employee_id: &str) -> Option<&mut Employee>
Get mutable employee by ID.
Sourcepub fn get_direct_reports(&self, manager_id: &str) -> Vec<&Employee>
pub fn get_direct_reports(&self, manager_id: &str) -> Vec<&Employee>
Get direct reports of a manager.
Sourcepub fn get_by_persona(&self, persona: UserPersona) -> Vec<&Employee>
pub fn get_by_persona(&self, persona: UserPersona) -> Vec<&Employee>
Get employees by persona.
Sourcepub fn get_by_department(&self, department_id: &str) -> Vec<&Employee>
pub fn get_by_department(&self, department_id: &str) -> Vec<&Employee>
Get employees by department.
Sourcepub fn get_random_approver(&self, rng: &mut impl Rng) -> Option<&Employee>
pub fn get_random_approver(&self, rng: &mut impl Rng) -> Option<&Employee>
Get a random employee with approval authority.
Sourcepub fn get_approver_for_amount(
&self,
amount: Decimal,
rng: &mut impl Rng,
) -> Option<&Employee>
pub fn get_approver_for_amount( &self, amount: Decimal, rng: &mut impl Rng, ) -> Option<&Employee>
Get approver for a specific amount.
Sourcepub fn get_managers(&self) -> Vec<&Employee>
pub fn get_managers(&self) -> Vec<&Employee>
Get all managers (employees with direct reports).
Sourcepub fn get_reporting_chain(&self, employee_id: &str) -> Vec<&Employee>
pub fn get_reporting_chain(&self, employee_id: &str) -> Vec<&Employee>
Get org chart path from employee to top.
Sourcepub fn rebuild_indices(&mut self)
pub fn rebuild_indices(&mut self)
Rebuild indices after deserialization.
Trait Implementations§
Source§impl Clone for EmployeePool
impl Clone for EmployeePool
Source§fn clone(&self) -> EmployeePool
fn clone(&self) -> EmployeePool
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EmployeePool
impl Debug for EmployeePool
Source§impl Default for EmployeePool
impl Default for EmployeePool
Source§fn default() -> EmployeePool
fn default() -> EmployeePool
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for EmployeePool
impl<'de> Deserialize<'de> for EmployeePool
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for EmployeePool
impl RefUnwindSafe for EmployeePool
impl Send for EmployeePool
impl Sync for EmployeePool
impl Unpin for EmployeePool
impl UnwindSafe for EmployeePool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more