Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix DeserializeFailed(Error("invalid length 9, expected fewer elements in array", line: 0, column: 0) (Issue #60) #61

Merged
merged 3 commits into from
Jan 16, 2025

Conversation

7jrxt42BxFZo4iAnN4CX
Copy link

Before:

  fn visit_seq<V>(self, mut seq: V) -> Result<TradingPeriods, V::Error>
  where
      V: SeqAccess<'de>,
  {
      let regular: Vec<PeriodInfo> = seq
          .next_element()?
          .ok_or_else(|| de::Error::invalid_length(0, &self))?;
      Ok(TradingPeriods {
          pre: None,
          regular: Some(vec![regular]),
          post: None,
      })
  }

After:

  fn visit_seq<V>(self, mut seq: V) -> Result<TradingPeriods, V::Error>
  where
  V: SeqAccess<'de>,
  {
  let mut regular: Vec<PeriodInfo> = Vec::new();
  
  println!("visit_seq");
  while let Ok(Some(mut e)) = seq.next_element::<Vec<PeriodInfo>>() {
	  regular.append(&mut e);
  }
  
  Ok(TradingPeriods { pre: None, regular: Some(vec![regular]), post: None })
  }

@7jrxt42BxFZo4iAnN4CX 7jrxt42BxFZo4iAnN4CX changed the title fix fix DeserializeFailed(Error("invalid length 9, expected fewer elements in array", line: 0, column: 0) (Issue #60) Jan 15, 2025
Copy link
Owner

@xemwebe xemwebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in the other PR, please run cargo fmt on your code with standard 4 white space tabs.

src/quotes.rs Outdated
{
let mut regular: Vec<PeriodInfo> = Vec::new();

println!("visit_seq");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this line.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@7jrxt42BxFZo4iAnN4CX
Copy link
Author

I disabled my rustfmt, but for some reason the imports are separate.

@xemwebe xemwebe merged commit 72a2f42 into xemwebe:master Jan 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants