Module resources

Module resources 

Source
Expand description

Resources are the fundamental units of value in Rustorio. Resources are held in either Resource or Bundle objects. Bundle objects are used to hold a fixed amount of a resource, while Resource objects can hold any amount.

This module the core definitions for resources, including the ResourceType trait, the Resource and Bundle structs, and the macro to define new resources.

Structs§

Assert
A compile-time assertion that a condition is true.
Bundle
Contains a fixed (compile-time known) amount of a resource. A Bundle can be used to build structures or as input for recipes.
InsufficientResourceError
Error returned when there are insufficient resources in a Resource to fulfill a request.
Resource
Holds an arbitrary amount of a resource. A Resource object can be split into smaller parts, combined or Bundles can be extracted from them.

Traits§

IsTrue
A trait implemented only for Assert<true>.
ResourceType
A type that represents a specific kind of resource in the game. Implementors of this trait represent different resource types, such as iron, copper, or science packs. Only useful as a type parameter; has no associated methods.

Functions§

bundle
Creates a new Bundle with the specified resource type and amount. Should not be reexported in mods.
resource
Creates a new Resource with the specified amount. Should not be reexported in mods.
resource_amount_mut
Returns a mutable reference to the amount of resource contained in the given Resource. Should not be reexported in mods.