Crates.io | essential-read |
lib.rs | essential-read |
version | 0.2.0 |
source | src |
created_at | 2024-07-08 04:35:49.966092 |
updated_at | 2024-08-23 03:10:14.598115 |
description | Utility crate for reading contracts and solutions from disk |
homepage | https://essential.builders/ |
repository | https://github.com/essential-contributions/essential-integration |
max_upload_size | |
id | 1295358 |
size | 9,684 |
This is a Rust library that contains utilities for reading and deserializing contracts and solutions. Functions skip subdirectories, non-JSON files and files that have non-valid UTF-8 names.
Return types are all wrapped in anyhow::Result
, omitted in the rest of the README for simplicity.
Reads and deserializes predicates from a file.
Argument:
PathBuf
.Returns:
Vec<Predicate>
, that is, a contract.Reads and deserializes contracts in a directory.
Argument:
PathBuf
.Returns:
Vec<Vec<Predicate>>
, where the inner vector is a single contract.Reads and deserializes a solution from a file.
Argument:
PathBuf
.Returns:
Solution
.Reads and deserializes solutions in a directory.
Argument:
PathBuf
.Returns:
Vec<Solution>
.Reads the contents of a file as bytes. This function can be used in cases where deserialization is not necessary.
Argument:
PathBuf
.Returns:
Vec<u8>
.Reads the contents of files in a directory as a vector of bytes. This function can be used in cases where deserialization is not necessary.
Argument:
PathBuf
.Returns:
Vec<Vec<u8>>
, where each inner vector is the contents of a file.Deserializes a contract from bytes.
Argument:
Vec<u8>
Returns:
Vec<Predicate>
, that is, a contract.Deserializes a solution from bytes.
Argument:
Vec<u8>
Returns:
Solution