Dirfile

Struct Dirfile 

Source
pub struct Dirfile {
    pub dirfile_open: *mut gd_dirfile_,
}
Expand description

Represents a wrapper for a DIRFILE, providing methods for interacting with Dirfile data.

Fields§

§dirfile_open: *mut gd_dirfile_

Pointer to the opened DIRFILE instance.

Implementations§

Source§

impl Dirfile

Source

pub fn new(path: &str) -> Self

Creates a new Dirfile instance by opening a specified path.

§Arguments
  • path - A string slice that holds the path to the Dirfile.
§Returns

A new Dirfile instance.

§Panics

This function will panic if the path cannot be converted to a CString.

Source

pub fn nfields(&self) -> u32

Retrieves the number of fields in the Dirfile.

§Returns

The number of fields as a u32.

Source

pub fn nframes(&self) -> i64

Retrieves the total number of frames in the Dirfile.

§Returns

The number of frames as an i64.

Source

pub fn spf(&self, field: &str) -> u32

Gets the number of samples per frame for a specified field.

§Arguments
  • field - The field name as a string slice.
§Returns

The number of samples per frame as a u32.

§Panics

This function will panic if the field name cannot be converted to a CString.

Source

pub fn field_type(&self, field: &str) -> u32

Retrieves the type of a specified field in the Dirfile.

§Arguments
  • field - The field name as a string slice.
§Returns

The field type as a u32.

§Panics

This function will panic if the field name cannot be converted to a CString.

Source

pub fn get_data(&self, field: &str) -> Vec<f64>

Retrieves the data for a specified field in the Dirfile and converts it to a Vec<f64>.

§Arguments
  • field - The field name as a string slice.
§Returns

A vector containing the data as f64 values. This is a general-purpose conversion that may not preserve the original precision of some data types.

§Panics

This function will panic if the field name cannot be converted to a CString.

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.