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
Bundlecan be used to build structures or as input for recipes. - Insufficient
Resource Error - Error returned when there are insufficient resources in a
Resourceto fulfill a request. - Resource
- Holds an arbitrary amount of a resource.
A
Resourceobject can be split into smaller parts, combined orBundles can be extracted from them.
Traits§
- IsTrue
- A trait implemented only for
Assert<true>. - Resource
Type - 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
Bundlewith the specified resource type and amount. Should not be reexported in mods. - resource
- Creates a new
Resourcewith 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.