Skip to main content

Expression

Struct Expression 

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

RAII wrapper for a duckdb_expression.

Automatically destroyed when dropped.

Implementations§

Source§

impl Expression

Source

pub const unsafe fn from_raw(raw: duckdb_expression) -> Self

Wraps a raw duckdb_expression handle, taking ownership.

§Safety

raw must be a valid duckdb_expression returned by a DuckDB API call (e.g. duckdb_scalar_function_bind_get_argument). The caller must not destroy the handle after this call.

Source

pub const fn as_raw(&self) -> duckdb_expression

Returns the raw handle without consuming the Expression.

Source

pub const fn is_null(&self) -> bool

Returns true if the underlying handle is null.

Source

pub fn return_type(&self) -> Option<LogicalType>

Returns the static return type of this expression, or None if the handle is null.

Source

pub fn is_foldable(&self) -> bool

Returns true if this expression is foldable — i.e. it is constant and can be evaluated to a single Value via fold without per-row input.

Source

pub fn fold(&self, context: &ClientContext) -> Result<Value, ErrorData>

Folds this (constant) expression into a single Value.

Only valid when is_foldable returns true.

§Errors

Returns the structured ErrorData if folding fails (for example because the expression is not constant).

Trait Implementations§

Source§

impl Drop for Expression

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.