builder/context
Types
Build context containing project modules and file I/O operations
The context provides access to analyzed modules and functions for reading and writing files during the build process. File operations are optimized to skip writes when content hasn’t changed.
pub opaque type BuildContext
Error types that can occur during build operations
pub type Error {
FileError(error: simplifile.FileError)
}
Constructors
-
FileError(error: simplifile.FileError)
Values
pub fn modules(
ctx: BuildContext,
) -> dict.Dict(String, module.Module)
Get the dictionary of all analyzed modules in the project
pub fn read(
ctx: BuildContext,
asset: asset.BuildAsset,
) -> Result(String, Error)
Read a file’s contents as a String
pub fn read_bits(
ctx: BuildContext,
asset: asset.BuildAsset,
) -> Result(BitArray, Error)
Read a file’s contents as a BitArray
pub fn write(
ctx: BuildContext,
asset: asset.BuildAsset,
contents: String,
) -> Result(Nil, Error)
Write a String to a file
Automatically skips the write if the file already contains the exact same content.
pub fn write_bits(
ctx: BuildContext,
asset: asset.BuildAsset,
bits: BitArray,
) -> Result(Nil, Error)
Write a BitArray to a file
Automatically skips the write if the file already contains the exact same content.