ReadStatParser

Struct ReadStatParser 

Source
pub(crate) struct ReadStatParser {
    parser: *mut readstat_parser_t,
}
Expand description

Safe RAII wrapper around the ReadStat C parser (readstat_parser_t).

Provides a builder-pattern API for configuring callbacks, row limits/offsets, and invoking the parse. The underlying C parser is freed on drop.

Fields§

§parser: *mut readstat_parser_t

Implementations§

Source§

impl ReadStatParser

Source

pub(crate) fn new() -> Self

Allocates and initializes a new ReadStat C parser.

Source

pub(crate) fn set_metadata_handler( self, metadata_handler: readstat_metadata_handler, ) -> Result<Self, ReadStatError>

Registers the callback invoked when file-level metadata is parsed.

Source

pub(crate) fn set_row_limit( self, row_limit: Option<u32>, ) -> Result<Self, ReadStatError>

Sets the maximum number of rows to read. None means no limit.

Source

pub(crate) fn set_row_offset( self, row_offset: Option<u32>, ) -> Result<Self, ReadStatError>

Sets the starting row offset for reading. None means start from row 0.

Source

pub(crate) fn set_variable_handler( self, variable_handler: readstat_variable_handler, ) -> Result<Self, ReadStatError>

Registers the callback invoked for each variable (column) definition.

Source

pub(crate) fn set_value_handler( self, value_handler: readstat_value_handler, ) -> Result<Self, ReadStatError>

Registers the callback invoked for each cell value during row parsing.

Source

pub(crate) fn set_open_handler( self, open_handler: readstat_open_handler, ) -> Result<Self, ReadStatError>

Registers a custom handler for opening the data source.

Source

pub(crate) fn set_close_handler( self, close_handler: readstat_close_handler, ) -> Result<Self, ReadStatError>

Registers a custom handler for closing the data source.

Source

pub(crate) fn set_seek_handler( self, seek_handler: readstat_seek_handler, ) -> Result<Self, ReadStatError>

Registers a custom handler for seeking within the data source.

Source

pub(crate) fn set_read_handler( self, read_handler: readstat_read_handler, ) -> Result<Self, ReadStatError>

Registers a custom handler for reading from the data source.

Source

pub(crate) fn set_update_handler( self, update_handler: readstat_update_handler, ) -> Result<Self, ReadStatError>

Registers a custom handler for progress updates.

Source

pub(crate) fn set_io_ctx( self, io_ctx: *mut c_void, ) -> Result<Self, ReadStatError>

Sets a custom I/O context pointer passed to all I/O handler callbacks.

Source

pub(crate) fn parse_sas7bdat( &mut self, path: *const c_char, user_ctx: *mut c_void, ) -> readstat_error_t

Parses a .sas7bdat file, invoking registered callbacks as data is read.

Returns the raw ReadStat error code. Use check_c_error to convert to a Result.

Trait Implementations§

Source§

impl Drop for ReadStatParser

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.