Function fastsim_core::utils::url_to_cache
source · pub fn url_to_cache<S: AsRef<str>, P: AsRef<Path>>(
url: S,
subpath: P
) -> Result<()>Expand description
takes an object from a url and saves it in the FASTSim data directory in a
rust_objects folder
WARNING: if there is a file already in the data subdirectory with the same
name, it will be replaced by the new file
to save to a folder other than rust_objects, define constant CACHE_FOLDER to
be the desired folder name
§Arguments
- url: url (either as a string or url type) to object
- subpath: path to subdirectory within FASTSim data directory. Suggested
paths are “vehicles” for a RustVehicle, “cycles” for a RustCycle, and
“rust_objects” for other Rust objects.
Note: In order for the file to be save in the proper format, the URL needs to be a URL pointing directly to a file, for example a raw github URL.