Skip to main content

DbConfig

Struct DbConfig 

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

RAII wrapper for a duckdb_config handle.

Configuration options are set via set and consumed by passing as_raw to duckdb_open_ext. The handle is destroyed automatically when DbConfig is dropped.

Implementations§

Source§

impl DbConfig

Source

pub fn new() -> Result<Self, ExtensionError>

Creates a new, empty DuckDB configuration object.

§Errors

Returns ExtensionError if DuckDB fails to allocate the config (which is extremely rare in practice).

Source

pub fn set(self, name: &str, value: &str) -> Result<Self, ExtensionError>

Sets a single configuration option.

Common options include "access_mode" ("READ_ONLY" / "READ_WRITE"), "threads" (number of CPU threads), and "memory_limit" (e.g. "1GB"). Use DbConfig::flag_count / DbConfig::get_flag to enumerate all available options at runtime.

§Errors

Returns ExtensionError if the option name or value is not recognised by DuckDB.

§Errors

Returns ExtensionError if name or value contain interior null bytes, or if DuckDB does not recognise the option.

Source

pub fn flag_count() -> usize

Returns the total number of available configuration flags.

Use this together with get_flag to enumerate all configuration options that DuckDB accepts.

Source

pub fn get_flag(index: usize) -> Result<(String, String), ExtensionError>

Returns the name and description for the configuration flag at index.

index must be less than flag_count().

§Errors

Returns ExtensionError if index is out of range or DuckDB fails to retrieve the flag information.

Source

pub const fn as_raw(&self) -> duckdb_config

Returns the underlying duckdb_config handle.

Pass this to duckdb_open_ext to open a database with these settings.

The handle remains owned by DbConfig; do not call duckdb_destroy_config on the returned value.

Trait Implementations§

Source§

impl Drop for DbConfig

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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.