pub struct MSRecord(/* private fields */);Expand description
miniSEED record structure.
Implementations§
source§impl MSRecord
impl MSRecord
sourcepub fn parse(buf: &[u8], flags: MSControlFlags) -> MSResult<Self>
pub fn parse(buf: &[u8], flags: MSControlFlags) -> MSResult<Self>
Parses a MSRecord from a slice of bytes.
sourcepub unsafe fn from_raw(ptr: *mut MS3Record) -> Self
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.
sourcepub fn into_raw(self) -> *mut MS3Record
pub fn into_raw(self) -> *mut MS3Record
Consumes the MSRecord and transfers ownership of the record to a C caller.
sourcepub fn unpack_data(&mut self) -> MSResult<c_long>
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.
sourcepub fn sid(&self) -> MSResult<String>
pub fn sid(&self) -> MSResult<String>
Returns the FDSN source identifier.
sourcepub fn sid_lossy(&self) -> String
pub fn sid_lossy(&self) -> String
Returns a lossy version of the FDSN source identifier.
sourcepub fn format_version(&self) -> c_uchar
pub fn format_version(&self) -> c_uchar
Returns the major format version of the underlying record.
sourcepub fn flags(&self) -> MSBitFieldFlags
pub fn flags(&self) -> MSBitFieldFlags
Returns the record level bit field flags.
sourcepub fn start_time(&self) -> MSResult<OffsetDateTime>
pub fn start_time(&self) -> MSResult<OffsetDateTime>
Returns the start time of the record (i.e. the time of the first sample).
sourcepub fn end_time(&self) -> MSResult<OffsetDateTime>
pub fn end_time(&self) -> MSResult<OffsetDateTime>
Calculates the end time of the last sample in the record.
sourcepub fn sample_rate_hz(&self) -> c_double
pub fn sample_rate_hz(&self) -> c_double
Returns the nominal sample rate as samples per second (Hz)
sourcepub fn encoding(&self) -> MSResult<MSDataEncoding>
pub fn encoding(&self) -> MSResult<MSDataEncoding>
Returns the data encoding format of the record.
sourcepub fn pub_version(&self) -> c_uchar
pub fn pub_version(&self) -> c_uchar
Returns the record publication version.
sourcepub fn sample_cnt(&self) -> c_long
pub fn sample_cnt(&self) -> c_long
Returns the number of data samples as indicated by the raw record.
sourcepub fn data_length(&self) -> c_ushort
pub fn data_length(&self) -> c_ushort
Returns the length of the data payload in bytes.
sourcepub fn extra_headers(&self) -> Option<&[c_uchar]>
pub fn extra_headers(&self) -> Option<&[c_uchar]>
Returns the records’ extra headers, if available.
sourcepub fn data_samples<T>(&self) -> Option<&[T]>
pub fn data_samples<T>(&self) -> Option<&[T]>
Returns the (unpacked) data samples of the record if available.
sourcepub fn num_samples(&self) -> c_long
pub fn num_samples(&self) -> c_long
Returns the number of (unpacked) data samples.
sourcepub fn sample_type(&self) -> MSSampleType
pub fn sample_type(&self) -> MSSampleType
Returns the record sample type.
sourcepub fn try_clone(&self) -> MSResult<Self>
pub fn try_clone(&self) -> MSResult<Self>
Creates a new independently owned MSRecord from the underlying record.
sourcepub fn display(&self, detail: i8) -> RecordDisplay<'_>
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 line1: 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));
}