pub struct SubcategoryDef {
pub name: String,
pub parent: TopLevelCategory,
pub display_name: Option<String>,
}Expand description
A subcategory entry — maps a subcategory name to a top-level parent.
Why: users need to extend the taxonomy without modifying the closed
TopLevelCategory enum; subcategories are the extension point.
What: bundles the subcategory name, its parent top-level, and an
optional human-readable display_name.
Test: covered by classify::tests::registry_merges_user_defined.
User-defined entries are loaded from YAML config and merged on top of the built-in defaults. Names are compared case-insensitively.
Fields§
§name: StringSubcategory name (e.g. "feature", "security", "payments").
parent: TopLevelCategoryTop-level parent this subcategory rolls up to.
display_name: Option<String>Optional human-readable label; falls back to name if absent.
Implementations§
Source§impl SubcategoryDef
impl SubcategoryDef
Sourcepub fn new(name: impl Into<String>, parent: TopLevelCategory) -> Self
pub fn new(name: impl Into<String>, parent: TopLevelCategory) -> Self
Construct a new definition.
Why: simple constructor avoids the boilerplate of building the
struct literal in test fixtures and YAML loaders.
What: stores name (any Into<String>), the parent variant, and
display_name = None.
Test: covered by classify::tests::registry_merges_user_defined.
Trait Implementations§
Source§impl Clone for SubcategoryDef
impl Clone for SubcategoryDef
Source§fn clone(&self) -> SubcategoryDef
fn clone(&self) -> SubcategoryDef
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SubcategoryDef
impl Debug for SubcategoryDef
Source§impl<'de> Deserialize<'de> for SubcategoryDef
impl<'de> Deserialize<'de> for SubcategoryDef
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>,
Auto Trait Implementations§
impl Freeze for SubcategoryDef
impl RefUnwindSafe for SubcategoryDef
impl Send for SubcategoryDef
impl Sync for SubcategoryDef
impl Unpin for SubcategoryDef
impl UnsafeUnpin for SubcategoryDef
impl UnwindSafe for SubcategoryDef
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more