VectorScan

Struct VectorScan 

Source
pub struct VectorScan;
Expand description

Safe wrappers around VectorScan API

Implementations§

Source§

impl VectorScan

Source

pub fn set_allocator( alloc_fn: AllocFunc, free_fn: FreeFunc, ) -> Result<(), String>

Set custom memory allocator

Source

pub fn clear_allocator() -> Result<(), String>

Clear custom memory allocator (use defaults)

Source

pub fn version() -> &'static str

Get version string

Source

pub fn valid_platform() -> Result<(), String>

Check if platform is valid

Source

pub fn compile( pattern: &str, flags: Flags, mode: Mode, platform: Option<&Platform>, ) -> Result<DatabasePtr, CompileError>

Compile a single pattern

Source

pub fn compile_lit_multi( literals: &[&[u8]], flags: &[Flags], ids: &[u32], mode: Mode, platform: Option<&Platform>, ) -> Result<DatabasePtr, CompileError>

Compile literal patterns

Source

pub fn compile_multi( patterns: &[&str], flags: &[Flags], ids: &[u32], mode: Mode, platform: Option<&Platform>, ) -> Result<DatabasePtr, CompileError>

Compile multiple patterns

Source

pub fn alloc_scratch(database: &DatabasePtr) -> Result<ScratchPtr, String>

Allocate scratch space

Source

pub fn scratch_size(scratch: &ScratchPtr) -> Result<usize, String>

Get scratch size

Source

pub fn scratch_realloc( scratch: &mut ScratchPtr, database: &DatabasePtr, ) -> Result<(), String>

Reallocate scratch for a database

Source

pub fn clone_scratch(src: &ScratchPtr) -> Result<ScratchPtr, String>

Clone scratch space

Source

pub fn scan<F>( database: &DatabasePtr, data: &[u8], scratch: &mut ScratchPtr, on_match: F, ) -> Result<(), String>
where F: FnMut(u32, u64, u64) -> Matching,

Scan data in block mode

Source

pub fn serialize_database(database: &DatabasePtr) -> Result<Vec<u8>, String>

Serialize database

Source

pub fn deserialize_database(data: &[u8]) -> Result<DatabasePtr, String>

Deserialize database

Source

pub fn database_size(database: &DatabasePtr) -> Result<usize, String>

Get database size

Source

pub fn stream_size(database: &DatabasePtr) -> Result<usize, String>

Get stream size

Source

pub fn database_info(database: &DatabasePtr) -> Result<String, String>

Get database info

Source

pub fn open_stream(database: &DatabasePtr) -> Result<StreamPtr, String>

Open a stream

Source

pub fn scan_stream<F>( stream: &mut StreamPtr, data: &[u8], scratch: &mut ScratchPtr, on_match: F, ) -> Result<(), String>
where F: FnMut(u32, u64, u64) -> Matching,

Scan stream

Source

pub fn close_stream<F>( stream: StreamPtr, scratch: &mut ScratchPtr, on_match: F, ) -> Result<(), String>
where F: FnMut(u32, u64, u64) -> Matching,

Close stream

Source

pub fn free_database(database: DatabasePtr)

Free database

Source

pub fn free_scratch(scratch: ScratchPtr)

Free scratch

Source

pub fn validate_expression( pattern: &str, flags: Flags, ) -> Result<(), ValidationError>

Validate a pattern expression

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.