Struct mseed::MSRecord

source ·
pub struct MSRecord(/* private fields */);
Expand description

miniSEED record structure.

Implementations§

source§

impl MSRecord

source

pub fn parse(buf: &[u8], flags: MSControlFlags) -> MSResult<Self>

Parses a MSRecord from a slice of bytes.

source

pub unsafe fn from_raw(ptr: *mut MS3Record) -> Self

Creates a MSRecord from a raw pointer. Takes ownership.

Safety

Takes ownership of a raw MS3Record pointer that was allocated by foreign code.

source

pub fn into_raw(self) -> *mut MS3Record

Consumes the MSRecord and transfers ownership of the record to a C caller.

source

pub fn unpack_data(&mut self) -> MSResult<c_long>

Unpacks the packed data of the record and returns the number of unpacked samples.

If the data is already unpacked, the number of previously unpacked samples is returned.

source

pub fn sid(&self) -> MSResult<String>

source

pub fn sid_lossy(&self) -> String

Returns a lossy version of the FDSN source identifier.

source

pub fn network(&self) -> MSResult<String>

Returns the network code identifier of the record.

source

pub fn station(&self) -> MSResult<String>

Returns the station code identifier of the record.

source

pub fn location(&self) -> MSResult<String>

Returns the location code identifier of the record.

source

pub fn channel(&self) -> MSResult<String>

Returns the channel code identifier of the record.

source

pub fn raw(&self) -> Option<&[c_uchar]>

Returns the raw miniSEED record, if available.

source

pub fn format_version(&self) -> c_uchar

Returns the major format version of the underlying record.

source

pub fn flags(&self) -> MSBitFieldFlags

Returns the record level bit field flags.

source

pub fn start_time(&self) -> MSResult<OffsetDateTime>

Returns the start time of the record (i.e. the time of the first sample).

source

pub fn end_time(&self) -> MSResult<OffsetDateTime>

Calculates the end time of the last sample in the record.

source

pub fn sample_rate_hz(&self) -> c_double

Returns the nominal sample rate as samples per second (Hz)

source

pub fn encoding(&self) -> MSResult<MSDataEncoding>

Returns the data encoding format of the record.

source

pub fn pub_version(&self) -> c_uchar

Returns the record publication version.

source

pub fn sample_cnt(&self) -> c_long

Returns the number of data samples as indicated by the raw record.

source

pub fn crc(&self) -> c_uint

Returns the CRC of the record.

source

pub fn data_length(&self) -> c_ushort

Returns the length of the data payload in bytes.

source

pub fn extra_headers(&self) -> Option<&[c_uchar]>

Returns the records’ extra headers, if available.

source

pub fn data_samples<T>(&self) -> Option<&[T]>

Returns the (unpacked) data samples of the record if available.

source

pub fn data_size(&self) -> usize

Returns the size of the (unpacked) data samples in bytes.

source

pub fn num_samples(&self) -> c_long

Returns the number of (unpacked) data samples.

source

pub fn sample_type(&self) -> MSSampleType

Returns the record sample type.

source

pub fn try_clone(&self) -> MSResult<Self>

Creates a new independently owned MSRecord from the underlying record.

source

pub fn display(&self, detail: i8) -> RecordDisplay<'_>

Returns an object that implements Display for printing a record with level detail.

The detail flag controls the level of detail displayed:

  • 0: print a single summary line
  • 1: print most header details
  • >1: print all header details
Examples

Print most header details (i.e. detail 1) of miniSEED records from a file:

use mseed::MSReader;

let mut reader = MSReader::new("path/to/data.mseed").unwrap();

while let Some(msr) = reader.next() {
   let msr = msr.unwrap();
   print!("{}", msr.display(1));
}

Trait Implementations§

source§

impl AsRef<[u8]> for MSRecord

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Debug for MSRecord

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for MSRecord

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for MSRecord

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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.