Skip to main content

Column

Struct Column 

Source
pub struct Column<F> { /* private fields */ }
Expand description

类型安全的列引用(对标 Java SFunction<T, ?> 的编译期列解析)。

Java 中 LambdaQueryWrapper 通过 User::getName 序列化 lambda 解析列名; Rust 没有运行时 lambda 反射,改用 Column<F> + derive 宏在编译期生成列名。

F 是字段的 Rust 类型(如 String、i64),用于编译期类型检查。

§用法

通常由 #[derive(TableName)] 宏自动生成,不需要手动构造:

ⓘ
use rbatis_plus::core::conditions::query::lambda_query_wrapper::Column;

// derive 宏会生成:User::column_name() -> Column<String>
let col: Column<String> = Column::new("user_name");
assert_eq!(col.name(), "user_name");

Implementations§

Source§

impl<F> Column<F>

Source

pub const fn new(name: &'static str) -> Column<F>

创建列引用。

通常由 derive 宏调用,用户无需手动构造。

Source

pub fn name(&self) -> &'static str

获取数据库列名。

Trait Implementations§

Source§

impl<F> Clone for Column<F>
where F: Clone,

Source§

fn clone(&self) -> Column<F>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F> Copy for Column<F>
where F: Copy,

Source§

impl<F> Debug for Column<F>
where F: Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<F> Freeze for Column<F>
where PhantomData<F>: Freeze,

§

impl<F> RefUnwindSafe for Column<F>

§

impl<F> Send for Column<F>
where PhantomData<F>: Send,

§

impl<F> Sync for Column<F>
where PhantomData<F>: Sync,

§

impl<F> Unpin for Column<F>
where PhantomData<F>: Unpin,

§

impl<F> UnsafeUnpin for Column<F>

§

impl<F> UnwindSafe for Column<F>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.