Skip to main content

ReplacementScanInfo

Struct ReplacementScanInfo 

Source
pub struct ReplacementScanInfo { /* private fields */ }
Expand description

Ergonomic wrapper around duckdb_replacement_scan_info.

Provides safe methods for the common replacement scan operations.

Implementations§

Source§

impl ReplacementScanInfo

Source

pub const EMPTY_ERROR_PLACEHOLDER: &'static str = "replacement scan reported an error without a message"

The message set_error reports in place of an empty one.

Source

pub const unsafe fn new(info: duckdb_replacement_scan_info) -> Self

Wraps a raw duckdb_replacement_scan_info.

§Safety

info must be a valid duckdb_replacement_scan_info provided by DuckDB.

Source

pub fn set_function(&self, function_name: &str) -> &Self

Redirects this scan to the named table function.

Call this first to name the table function that will handle the scan, then use add_varchar_parameter or add_parameter_raw to pass arguments.

If function_name contains an interior null byte it is truncated at that point.

Source

pub fn add_varchar_parameter(&self, value: &str) -> &Self

Adds a VARCHAR string parameter to the redirected function call.

This is the most common use case: passing the original file path/name to the underlying table function.

Source

pub unsafe fn add_parameter_raw(&self, value: duckdb_value) -> &Self

Adds a raw duckdb_value parameter to the redirected function call.

Use this when you need to pass non-VARCHAR parameters (INTEGER, BIGINT, BOOLEAN, etc.) that aren’t covered by add_varchar_parameter.

DuckDB copies the value; the caller still owns value and must destroy it after this call.

§Safety

value must be a valid duckdb_value created via a duckdb_create_* function.

Source

pub fn add_i64_parameter(&self, value: i64) -> &Self

Adds a BIGINT (i64) parameter to the redirected function call.

Convenience method that creates a DuckDB BIGINT value, adds it as a parameter, and destroys the temporary value.

Source

pub fn add_bool_parameter(&self, value: bool) -> &Self

Adds a BOOLEAN parameter to the redirected function call.

Convenience method that creates a DuckDB BOOLEAN value, adds it as a parameter, and destroys the temporary value.

Source

pub fn set_error(&self, message: &str)

Reports an error, causing DuckDB to abort this replacement scan attempt.

An interior null byte in message is replaced by ?.

DuckDB only raises the error when the stored message is non-empty, so an empty message would be silently ignored and the query would fall through to “table does not exist”. It is replaced with EMPTY_ERROR_PLACEHOLDER instead.

Source

pub const fn as_raw(&self) -> duckdb_replacement_scan_info

Returns the raw duckdb_replacement_scan_info handle.

Trait Implementations§

Source§

impl Debug for ReplacementScanInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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, 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.