#[non_exhaustive]#[repr(u16)]pub enum Domain {
Show 21 variants
General = 0,
GraphAnalytics = 1,
StatisticalML = 2,
Compliance = 3,
RiskManagement = 4,
OrderMatching = 5,
MarketData = 6,
Settlement = 7,
Accounting = 8,
NetworkAnalysis = 9,
FraudDetection = 10,
TimeSeries = 11,
Simulation = 12,
Banking = 13,
BehavioralAnalytics = 14,
ProcessIntelligence = 15,
Clearing = 16,
TreasuryManagement = 17,
PaymentProcessing = 18,
FinancialAudit = 19,
Custom = 100,
}Expand description
Business domain classification for kernel messages.
Each domain has an assigned type ID range to prevent collisions:
- General: 0-99
- GraphAnalytics: 100-199
- StatisticalML: 200-299
- Compliance: 300-399
- RiskManagement: 400-499
- OrderMatching: 500-599
- MarketData: 600-699
- Settlement: 700-799
- Accounting: 800-899
- NetworkAnalysis: 900-999
- FraudDetection: 1000-1099
- TimeSeries: 1100-1199
- Simulation: 1200-1299
- Banking: 1300-1399
- BehavioralAnalytics: 1400-1499
- ProcessIntelligence: 1500-1599
- Clearing: 1600-1699
- TreasuryManagement: 1700-1799
- PaymentProcessing: 1800-1899
- FinancialAudit: 1900-1999
- Custom: 10000+
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
General = 0
General-purpose messages (type IDs: 0-99).
GraphAnalytics = 1
Graph analytics messages (type IDs: 100-199). Includes: PageRank, community detection, centrality measures.
StatisticalML = 2
Statistical/ML messages (type IDs: 200-299). Includes: regression, clustering, classification.
Compliance = 3
Compliance/regulatory messages (type IDs: 300-399). Includes: AML checks, KYC validation, regulatory reporting.
RiskManagement = 4
Risk management messages (type IDs: 400-499). Includes: VaR calculation, stress testing, exposure analysis.
OrderMatching = 5
Order matching messages (type IDs: 500-599). Includes: order submission, matching, cancellation.
MarketData = 6
Market data messages (type IDs: 600-699). Includes: quotes, trades, order book updates.
Settlement = 7
Settlement messages (type IDs: 700-799). Includes: trade settlement, netting, reconciliation.
Accounting = 8
Accounting messages (type IDs: 800-899). Includes: journal entries, ledger updates, trial balance.
NetworkAnalysis = 9
Network analysis messages (type IDs: 900-999). Includes: transaction flow, counterparty analysis.
FraudDetection = 10
Fraud detection messages (type IDs: 1000-1099). Includes: anomaly detection, pattern matching.
TimeSeries = 11
Time series messages (type IDs: 1100-1199). Includes: forecasting, trend analysis, seasonality.
Simulation = 12
Simulation messages (type IDs: 1200-1299). Includes: Monte Carlo, scenario analysis, stress testing.
Banking = 13
Banking messages (type IDs: 1300-1399). Includes: account management, transfers, statements.
BehavioralAnalytics = 14
Behavioral analytics messages (type IDs: 1400-1499). Includes: user behavior, clickstream, session analysis.
ProcessIntelligence = 15
Process intelligence messages (type IDs: 1500-1599). Includes: process mining, DFG, conformance checking.
Clearing = 16
Clearing messages (type IDs: 1600-1699). Includes: CCP clearing, margin calculation, position netting.
TreasuryManagement = 17
Treasury management messages (type IDs: 1700-1799). Includes: cash management, liquidity, FX hedging.
PaymentProcessing = 18
Payment processing messages (type IDs: 1800-1899). Includes: payment initiation, routing, confirmation.
FinancialAudit = 19
Financial audit messages (type IDs: 1900-1999). Includes: audit trails, evidence gathering, compliance verification.
Custom = 100
Custom domain (type IDs: 10000+). For application-specific domains not covered by predefined ones.
Implementations§
Source§impl Domain
impl Domain
Sourcepub const RANGE_SIZE: u64 = 100u64
pub const RANGE_SIZE: u64 = 100u64
Number of type IDs reserved per domain (except Custom).
Sourcepub const CUSTOM_BASE: u64 = 10_000u64
pub const CUSTOM_BASE: u64 = 10_000u64
Base type ID for custom domains.
Sourcepub const fn base_type_id(&self) -> u64
pub const fn base_type_id(&self) -> u64
Get the base type ID for this domain.
Type IDs for messages in this domain should be: base_type_id() + offset
where offset is 0-99.
§Example
use ringkernel_core::domain::Domain;
assert_eq!(Domain::General.base_type_id(), 0);
assert_eq!(Domain::OrderMatching.base_type_id(), 500);
assert_eq!(Domain::Custom.base_type_id(), 10000);Sourcepub const fn max_type_id(&self) -> u64
pub const fn max_type_id(&self) -> u64
Get the maximum type ID for this domain.
§Example
use ringkernel_core::domain::Domain;
assert_eq!(Domain::General.max_type_id(), 99);
assert_eq!(Domain::OrderMatching.max_type_id(), 599);Sourcepub const fn contains_type_id(&self, type_id: u64) -> bool
pub const fn contains_type_id(&self, type_id: u64) -> bool
Check if a type ID is within this domain’s range.
§Example
use ringkernel_core::domain::Domain;
assert!(Domain::OrderMatching.contains_type_id(500));
assert!(Domain::OrderMatching.contains_type_id(599));
assert!(!Domain::OrderMatching.contains_type_id(600));Sourcepub const fn from_type_id(type_id: u64) -> Option<Self>
pub const fn from_type_id(type_id: u64) -> Option<Self>
Determine which domain a type ID belongs to.
Returns None if the type ID doesn’t match any standard domain.
§Example
use ringkernel_core::domain::Domain;
assert_eq!(Domain::from_type_id(501), Some(Domain::OrderMatching));
assert_eq!(Domain::from_type_id(10500), Some(Domain::Custom));Sourcepub fn from_str(s: &str) -> Option<Self>
pub fn from_str(s: &str) -> Option<Self>
Parse domain from string (case-insensitive).
Supports various naming conventions:
- PascalCase: “OrderMatching”
- snake_case: “order_matching”
- lowercase: “ordermatching”
- Short forms: “risk”, “ml”, “sim”
§Example
use ringkernel_core::domain::Domain;
assert_eq!(Domain::from_str("OrderMatching"), Some(Domain::OrderMatching));
assert_eq!(Domain::from_str("order_matching"), Some(Domain::OrderMatching));
assert_eq!(Domain::from_str("risk"), Some(Domain::RiskManagement));
assert_eq!(Domain::from_str("unknown"), None);Sourcepub const fn as_str(&self) -> &'static str
pub const fn as_str(&self) -> &'static str
Get the domain name as a static string.
Returns the PascalCase canonical name.
Sourcepub const fn all_standard() -> &'static [Domain]
pub const fn all_standard() -> &'static [Domain]
Get all standard domains (excluding Custom).