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_tImplementations§
Source§impl ReadStatParser
impl ReadStatParser
Sourcepub(crate) fn set_metadata_handler(
self,
metadata_handler: readstat_metadata_handler,
) -> Result<Self, ReadStatError>
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.
Sourcepub(crate) fn set_row_limit(
self,
row_limit: Option<u32>,
) -> Result<Self, ReadStatError>
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.
Sourcepub(crate) fn set_row_offset(
self,
row_offset: Option<u32>,
) -> Result<Self, ReadStatError>
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.
Sourcepub(crate) fn set_variable_handler(
self,
variable_handler: readstat_variable_handler,
) -> Result<Self, ReadStatError>
pub(crate) fn set_variable_handler( self, variable_handler: readstat_variable_handler, ) -> Result<Self, ReadStatError>
Registers the callback invoked for each variable (column) definition.
Sourcepub(crate) fn set_value_handler(
self,
value_handler: readstat_value_handler,
) -> Result<Self, ReadStatError>
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.
Sourcepub(crate) fn set_open_handler(
self,
open_handler: readstat_open_handler,
) -> Result<Self, ReadStatError>
pub(crate) fn set_open_handler( self, open_handler: readstat_open_handler, ) -> Result<Self, ReadStatError>
Registers a custom handler for opening the data source.
Sourcepub(crate) fn set_close_handler(
self,
close_handler: readstat_close_handler,
) -> Result<Self, ReadStatError>
pub(crate) fn set_close_handler( self, close_handler: readstat_close_handler, ) -> Result<Self, ReadStatError>
Registers a custom handler for closing the data source.
Sourcepub(crate) fn set_seek_handler(
self,
seek_handler: readstat_seek_handler,
) -> Result<Self, ReadStatError>
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.
Sourcepub(crate) fn set_read_handler(
self,
read_handler: readstat_read_handler,
) -> Result<Self, ReadStatError>
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.
Sourcepub(crate) fn set_update_handler(
self,
update_handler: readstat_update_handler,
) -> Result<Self, ReadStatError>
pub(crate) fn set_update_handler( self, update_handler: readstat_update_handler, ) -> Result<Self, ReadStatError>
Registers a custom handler for progress updates.
Sourcepub(crate) fn set_io_ctx(
self,
io_ctx: *mut c_void,
) -> Result<Self, ReadStatError>
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.
Sourcepub(crate) fn parse_sas7bdat(
&mut self,
path: *const c_char,
user_ctx: *mut c_void,
) -> readstat_error_t
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§
Auto Trait Implementations§
impl Freeze for ReadStatParser
impl RefUnwindSafe for ReadStatParser
impl !Send for ReadStatParser
impl !Sync for ReadStatParser
impl Unpin for ReadStatParser
impl UnwindSafe for ReadStatParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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