Skip to content

Commit

Permalink
Pass argument by ref
Browse files Browse the repository at this point in the history
  • Loading branch information
sanpii committed Feb 16, 2023
1 parent 23bdc29 commit d6620d6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ impl Generator {
/**
* Import data for arbitrary waveform generation.
*/
pub fn set_arbitrary_waveform(&self, source: Source, data: Vec<f32>) {
pub fn set_arbitrary_waveform(&self, source: Source, data: &[f32]) {
let mut data = data
.iter()
.fold(String::new(), |acc, e| format!("{acc}{e},"));
Expand Down Expand Up @@ -498,7 +498,7 @@ mod test {
let (rx, rp) = crate::test::create_client();

rp.generator
.set_arbitrary_waveform(crate::generator::Source::OUT1, vec![1.0, 0.5, 0.2]);
.set_arbitrary_waveform(crate::generator::Source::OUT1, &[1.0, 0.5, 0.2]);
assert_eq!("SOUR1:TRAC:DATA:DATA 1,0.5,0.2\r\n", rx.recv().unwrap());

#[cfg(feature = "mock")]
Expand Down

0 comments on commit d6620d6

Please sign in to comment.