Expand description
§rvf - Rust ValueFlows Implementation
Rust implementation of the ValueFlows vocabulary for distributed economic networks.
ValueFlows is a vocabulary for the distributed economic networks of the next economy, designed to coordinate the creation, distribution, and exchange of economic resources.
§Core Concepts
The library implements the REA (Resources, Events, Agents) ontology with the following core concepts:
- Agents: People, organizations, or ecological agents that participate in economic activity
- Resources: Economic resources that can be created, transferred, or consumed
- Events: Economic events that record what actually happened
- Commitments: Promises/plans for future events
- Intents: Offers and requests that may lead to commitments
- Processes: Transformations that take inputs and produce outputs
- Actions: Define what a flow does (produce, consume, transfer, etc.)
§Features
serde(default): Enable serialization/deserialization supportuuid(default): Enable UUID generation for identifiersasync: Enable async support for storage backendsfull: Enable all features
§Example
use rvf::prelude::*;
// Create an agent
let farmer = Agent::builder()
.id("agent-001")
.name("Local Farm")
.agent_type(AgentType::Organization)
.build()
.unwrap();
// Create a resource specification
let tomato_spec = ResourceSpecification::builder()
.id("spec-001")
.name("Organic Tomatoes")
.build()
.unwrap();
// Create an economic resource
let tomatoes = EconomicResource::builder()
.id("resource-001")
.name("Farm Tomatoes Batch #1")
.conforms_to(tomato_spec.id.clone())
.primary_accountable(farmer.id.clone())
.accounting_quantity(Measure::new(100, Unit::Kilogram))
.build()
.unwrap();§Architecture
The library is designed to be:
- Storage-agnostic: Use the provided
Storagetrait to implement any backend - P2P-ready: All types are serializable and designed for distributed systems
- Type-safe: Leverages Rust’s type system to prevent invalid states
- Extensible: Easy to add custom classifications and behaviors
Modules§
- actions
- Actions that define what a flow does
- agents
- Agents: people, organizations, and ecological agents
- commitments
- Commitments - promises for future economic events
- error
- Error types for the ValueFlows implementation
- events
- Economic Events
- exchanges
- Exchanges - reciprocal transfers between agents
- flows
- Flows - the core abstraction for economic activity
- intents
- Intents - offers and requests for economic activity
- measures
- Measurement units and quantities for economic resources
- plans
- Plans - operational planning for economic activity
- prelude
- Re-exports of commonly used types
- processes
- Processes - transformations of economic resources
- proposals
- Proposals - offers and requests for economic activity
- recipes
- Recipes - knowledge layer for reusable economic patterns
- resources
- Economic Resources and Resource Specifications
- storage
- Storage abstraction for ValueFlows data
- transfers
- Transfers - moving resources between agents
Structs§
- Date
Time - ISO 8601 combined date and time with time zone.
- Decimal
Decimalrepresents a 128 bit representation of a fixed-precision decimal number. The finite set of values of typeDecimalare of the form m / 10e, where m is an integer such that -296 < m < 296, and e is an integer between 0 and 28 inclusive.- Utc
- The UTC time zone. This is the most efficient time zone when you don’t need the local time. It is also used as an offset (which is also a dummy type).
- Uuid
- A Universally Unique Identifier (UUID).
Functions§
- generate_
id - Generate a new unique identifier