pub struct CostCenter {
pub id: String,
pub name: String,
pub parent_id: Option<String>,
pub company_code: String,
pub responsible_person: Option<String>,
pub category: CostCenterCategory,
pub level: u8,
pub is_active: bool,
}Expand description
A cost center node in the organizational cost hierarchy.
Cost centers are arranged in a two-level tree:
- Level 1 (parent): Represents a department (e.g., Finance, Production).
These have
parent_id == None. - Level 2 (child): Represents a sub-department or functional unit
(e.g., Accounts Payable within Finance). These have
parent_id == Some(...).
Fields§
§id: StringUnique cost center identifier (e.g., “CC-C001-FIN”)
name: StringHuman-readable name (e.g., “Finance Department”)
parent_id: Option<String>Parent cost center ID for level-2 nodes; None for level-1 department nodes.
company_code: StringCompany code this cost center belongs to.
responsible_person: Option<String>Employee ID of the person responsible for this cost center.
category: CostCenterCategoryFunctional category of this cost center.
level: u8Hierarchy level (1 = department, 2 = sub-department).
is_active: boolWhether this cost center is currently active.
Implementations§
Source§impl CostCenter
impl CostCenter
Sourcepub fn department(
id: impl Into<String>,
name: impl Into<String>,
company_code: impl Into<String>,
category: CostCenterCategory,
) -> Self
pub fn department( id: impl Into<String>, name: impl Into<String>, company_code: impl Into<String>, category: CostCenterCategory, ) -> Self
Create a new level-1 (department) cost center.
Trait Implementations§
Source§impl Clone for CostCenter
impl Clone for CostCenter
Source§fn clone(&self) -> CostCenter
fn clone(&self) -> CostCenter
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 CostCenter
impl Debug for CostCenter
Source§impl<'de> Deserialize<'de> for CostCenter
impl<'de> Deserialize<'de> for CostCenter
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 CostCenter
impl RefUnwindSafe for CostCenter
impl Send for CostCenter
impl Sync for CostCenter
impl Unpin for CostCenter
impl UnsafeUnpin for CostCenter
impl UnwindSafe for CostCenter
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