foundation capa

foundation-modules

Feature flag system for enabling/disabling functionality per organization

Feature flag system for enabling/disabling functionality per organization

Tierfoundation
Roleunclassified (baselined)
Pathcrates/foundation/modules
Edition2021
Targetsfoundation_modules
Public items37 across 0 modules
Tests30

What it is for

Feature flag system for enabling/disabling functionality per organization.

This crate provides:

Capabilities

Module

Feature flag system for enabling/disabling functionality per organization.

Item
pub struct Module
Module :: fn new(slug : impl Into <String>, name : impl Into <String>) -> Self
Module :: fn with_description(mut self, description : impl Into <String>) -> Self
Module :: fn as_core(mut self) -> Self
Module :: fn with_trial_days(mut self, days : i32) -> Self
Module :: fn with_dependency(mut self, slug : impl Into <String>) -> Self
Module :: fn deactivate(& mut self)
Module :: fn activate(& mut self)
Module :: fn id(& self) -> Uuid
Module :: fn created_at(& self) -> DateTime <Utc>
Module :: fn updated_at(& self) -> DateTime <Utc>
Module :: fn deleted_at(& self) -> Option <DateTime <Utc>>

ModuleError

Feature flag system for enabling/disabling functionality per organization.

Item
pub enum ModuleError

ModuleRegistry

Feature flag system for enabling/disabling functionality per organization.

Item
pub struct ModuleRegistry
ModuleRegistry :: fn new() -> Self
ModuleRegistry :: fn register(& mut self, module : Module)
ModuleRegistry :: fn get(& self, slug : & str) -> Option <& Module>
ModuleRegistry :: fn active_modules(& self) -> Vec <& Module>
ModuleRegistry :: fn core_modules(& self) -> Vec <& Module>
ModuleRegistry :: fn check_dependencies(& self, slug : & str, enabled_slugs : & & str) -> bool

ModuleStatus

Feature flag system for enabling/disabling functionality per organization.

Item
pub enum ModuleStatus
ModuleStatus :: fn is_accessible(& self) -> bool
ModuleStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
ModuleStatus :: fn from_str(s : & str) -> std::result::Result <Self, Self::Err>

OrgModuleState

Feature flag system for enabling/disabling functionality per organization.

Item
pub struct OrgModuleState
OrgModuleState :: fn new(organization_id : Uuid, module_id : Uuid) -> Self
OrgModuleState :: fn enable(& mut self) -> Result <()>
OrgModuleState :: fn disable(& mut self) -> Result <()>
OrgModuleState :: fn start_trial(& mut self, days : i32)
OrgModuleState :: fn is_accessible(& self) -> bool
OrgModuleState :: fn is_trial_valid(& self) -> bool
OrgModuleState :: fn trial_days_remaining(& self) -> Option <i64>
OrgModuleState :: fn set_config(& mut self, config : serde_json::Value)
OrgModuleState :: fn id(& self) -> Uuid
OrgModuleState :: fn created_at(& self) -> DateTime <Utc>
OrgModuleState :: fn updated_at(& self) -> DateTime <Utc>

Result

Feature flag system for enabling/disabling functionality per organization.

Item
pub type Result<T>: std::result::Result <T, ModuleError>

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

No public modules: the crate root is its whole surface.

Public surface

`crate root`

ItemWhat it is
pub enum ModuleErrorErrors that can occur in module operations.
pub type Result<T>: std::result::Result <T, ModuleError>Result type for module operations.
pub enum ModuleStatusStatus of a module for an organization.
ModuleStatus :: fn is_accessible(& self) -> boolReturns true if the module is accessible (enabled or in valid trial).
ModuleStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
ModuleStatus :: fn from_str(s : & str) -> std::result::Result <Self, Self::Err>
pub struct ModuleA feature module that can be enabled/disabled per organization.
Module :: fn new(slug : impl Into <String>, name : impl Into <String>) -> SelfCreates a new module.
Module :: fn with_description(mut self, description : impl Into <String>) -> SelfSets the description.
Module :: fn as_core(mut self) -> SelfMarks as a core module.
Module :: fn with_trial_days(mut self, days : i32) -> SelfSets trial duration in days.
Module :: fn with_dependency(mut self, slug : impl Into <String>) -> SelfAdds a dependency.
Module :: fn deactivate(& mut self)Deactivates the module.
Module :: fn activate(& mut self)Activates the module.
Module :: fn id(& self) -> Uuid
Module :: fn created_at(& self) -> DateTime <Utc>
Module :: fn updated_at(& self) -> DateTime <Utc>
Module :: fn deleted_at(& self) -> Option <DateTime <Utc>>
pub struct OrgModuleStateModule state for a specific organization.
OrgModuleState :: fn new(organization_id : Uuid, module_id : Uuid) -> SelfCreates a new organization module state.
OrgModuleState :: fn enable(& mut self) -> Result <()>Enables the module
OrgModuleState :: fn disable(& mut self) -> Result <()>Disables the module
OrgModuleState :: fn start_trial(& mut self, days : i32)Starts a trial period.
OrgModuleState :: fn is_accessible(& self) -> boolChecks if the module is accessible.
OrgModuleState :: fn is_trial_valid(& self) -> boolChecks if trial is still valid.
OrgModuleState :: fn trial_days_remaining(& self) -> Option <i64>Returns days remaining in trial.
OrgModuleState :: fn set_config(& mut self, config : serde_json::Value)Sets custom configuration.
OrgModuleState :: fn id(& self) -> Uuid
OrgModuleState :: fn created_at(& self) -> DateTime <Utc>
OrgModuleState :: fn updated_at(& self) -> DateTime <Utc>
pub struct ModuleRegistryA registry for managing modules.
ModuleRegistry :: fn new() -> SelfCreates a new empty registry.
ModuleRegistry :: fn register(& mut self, module : Module)Registers a module.
ModuleRegistry :: fn get(& self, slug : & str) -> Option <& Module>Gets a module by slug.
ModuleRegistry :: fn active_modules(& self) -> Vec <& Module>Gets all active modules.
ModuleRegistry :: fn core_modules(& self) -> Vec <& Module>Gets all core modules.
ModuleRegistry :: fn check_dependencies(& self, slug : & str, enabled_slugs : & & str) -> boolChecks if all dependencies for a module are satisfied.

No pub use re-exports: every item above is declared in this crate.

Boundary

Depends on no other workspace tier.

Shares tier foundation with 27 other crates: foundation-audit-log, foundation-basemodels, foundation-bounded-io, foundation-conversation-closure, foundation-crypto-sign, foundation-decisioning, foundation-encounter-vocabulary, foundation-fs-metadata, … (27 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)foundation
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/foundation/modules
Vocabulary in force (lexicon)current

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`foundation-basemodels`foundationnoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
chrono^0.4serdenoalways
serde^1derivenoalways
serde_json^1noalways
thiserror^2noalways
uuid^1v4, v7, serde, jsnoalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
tokio-test^0.4noalways

Build. None.

Depended on by. 1 workspace crate.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  n_application_feature_flags["application-feature-flags"] -->|uses| SELF
  SELF["foundation-modules"]
  SELF -->|runtime| n_foundation_basemodels["foundation-basemodels"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
libfoundation_modules`src/lib.rs`

Error model

Error typeNamed by
ModuleErrorResult

Operational characteristics

PropertyEvidence
async public surfacenone detected
async runtimenone detected
database accessnone detected
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

1 workspace crate depends on this one: application-feature-flags.

Verification

KindCount
Unit tests30
Integration tests0
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root601

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc2837
Public modules with a //! block00
pie showData
    title Public items with rustdoc
    "Documented" : 28
    "No rustdoc detected" : 9

Metrics

MetricValue
Rust source files1
Source lines688
Code lines507
Public API items37
Public modules0
Tests30
Examples0
Cargo features0
Direct runtime dependencies6
Workspace reverse dependencies1
pie showData
    title Public API by kind
    "enum" : 2
    "method" : 31
    "struct" : 3
    "type alias" : 1
pie showData
    title Rust source composition
    "Code" : 507
    "Blank or comment" : 181

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

Todas las foundation · Manual