Struct SdrFileReader

Source
pub struct SdrFileReader { /* private fields */ }
Expand description

Create a new SdrFileReader using the builder pattern. Then call read_next_chunk_complexf32 or read_next_chunk_complexf64 to read the samples.

§Example

use sdr_iq_file_reader::{SdrFileReader, SampleType};
let mut reader = SdrFileReader::builder()
    .file_path("gqrx_20240929_015218_580206500_2400000_fc.raw")
    .samples_per_chunk(1024)
    .sample_type(SampleType::F32)
    .build()
    .expect("Failed to create SdrFileReader");
let samples = reader.read_next_chunk_complexf32().unwrap();

Implementations§

Source§

impl SdrFileReader

Source

pub fn read_next_chunk_complexf32( &mut self, ) -> Result<Option<Vec<Complex<f32>>>, Error>

Read the next chunk of samples as Complex from the file.

§Warning

If you have set the sample type to SampleType::F64, you should use read_next_chunk_complexf64 instead. Otherwise, the values will be truncated and you will lose accuracy.

§Returns
  • Ok(Some(samples)) if there are samples in the chunk
  • Ok(None) if the end of the file is reached
§Errors
  • std::io::Error if there was an error reading the file other than reaching the end
Source

pub fn read_next_chunk_complexf64( &mut self, ) -> Result<Option<Vec<Complex<f64>>>, Error>

Read the next chunk of samples as Complex from the file.

§Returns
  • Ok(Some(samples)) if there are samples in the chunk
  • Ok(None) if the end of the file is reached
§Errors
  • std::io::Error if there was an error reading the file other than reaching the end
Source

pub fn builder<__0>() -> SdrFileReaderBuilder<__0>
where __0: AsRef<Path>,

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.