Skip to content

Commit

Permalink
from_csv_str calls from_str instead of vice versa
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Carow authored and Kyle Carow committed Jan 25, 2024
1 parent aab625c commit 73d3285
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rust/fastsim-core/src/cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ impl SerdeAPI for RustCycle {
match format.trim_start_matches('.').to_lowercase().as_str() {
"yaml" | "yml" => Self::from_yaml(contents)?,
"json" => Self::from_json(contents)?,
"csv" => Self::from_csv_str(contents, "".to_string())?,
"csv" => Self::from_reader(contents.as_ref().as_bytes(), "csv")?,
_ => bail!(
"Unsupported format {format:?}, must be one of {:?}",
Self::ACCEPTED_STR_FORMATS
Expand Down Expand Up @@ -805,7 +805,7 @@ impl RustCycle {

/// Load cycle from CSV string
pub fn from_csv_str<S: AsRef<str>>(csv_str: S, name: String) -> anyhow::Result<Self> {
let mut cyc = Self::from_reader(csv_str.as_ref().as_bytes(), "csv")?;
let mut cyc = Self::from_str(csv_str, "csv")?;
cyc.name = name;
Ok(cyc)
}
Expand Down

0 comments on commit 73d3285

Please sign in to comment.