Expand description
Utility functions
Re-exportsยง
use crate::Config;๐use alloy_primitives::U256;๐use figment::value::Value;๐use foundry_compilers::artifacts::remappings::Remapping;๐use foundry_compilers::artifacts::remappings::RemappingError;๐use serde::Deserialize;๐use serde::Deserialize;๐use serde::Deserializer;๐use serde::Serializer;๐use serde::de::DeserializeOwned;๐use serde::de::Error;๐use serde::de::IgnoredAny;๐use serde::de::MapAccess;๐use serde::de::Visitor;๐use std::fmt;๐use std::fs;๐use std::io;๐use std::io::BufReader;๐use std::path::Path;๐use std::path::PathBuf;๐use std::str::FromStr;๐
Structsยง
- Build
Info ๐Input - Reads the
inputof a build info intoinput. - Foundry
Toml ๐Dir - A depth-one dependency path and the canonical directory it resolves to.
- Present ๐
- A value that is there, deserialized without reading it.
read_build_info_inputstops after the input, soread_build_info_input::<Present>only checks that a build info has one.
Enumsยง
- Numeric
- Helper type to parse both
u64andU256
Functionsยง
- deserialize_
stringified_ ๐percent - Deserialize stringified percent. The value must be between 0 and 100 inclusive.
- deserialize_
u64_ ๐or_ max - Deserialize a
u64or โmaxโ foru64::MAX. - deserialize_
u64_ to_ u256 - Deserialize into
U256from either au64, aU256hex string, or a decimal string. - deserialize_
usize_ ๐or_ max - Deserialize a
usizeor โmaxโ forusize::MAX. - find_
git_ root - Returns the path of the top-level directory of the working git tree.
- find_
project_ root - Returns the root path to set for the project root.
- foundry_
toml_ ๐dir_ entries - Returns depth-one dependency entries that resolve to directories containing
foundry.toml. - foundry_
toml_ dirs - Returns a list of unique paths to all folders under
rootthat contain afoundry.tomlfile - get_
dir_ ๐remapping - Returns a remapping for the given dir
- load_
config - Loads the config for the current project workspace.
- load_
config_ with_ root - Loads the config for the current project workspace or the provided root path.
- read_
build_ info_ input - Reads the compiler
inputof the build info atpath, orNoneif the build info leaves it out, as build infos do unlessbuild_infois set. A JSON object with neither anidnor aninputis not a build info and fails. - remappings_
from_ env_ var - Returns the remappings from the given var
- remappings_
from_ newline - Returns all [
Remapping]s contained in theremappingsstr separated by newlines - serialize_
u64_ or_ u256 - Serialize
U256asu64if it fits, otherwise as a hex string. If the number fits into a i64, serialize it as number without quotation marks. If the number fits into a u64, serialize it as a stringified number with quotation marks. Otherwise, serialize it as a hex string with quotation marks. - serialize_
usize_ ๐or_ max - Serialize a
usizeas"max"if it equalsusize::MAX, as a string if it exceedsi64::MAX(TOML integer limit), or as a plain number otherwise. - to_
array_ value - Converts the
valinto afigment::Value::Array