pub struct Param<'a, V: SQLParam> {
pub placeholder: Placeholder,
pub value: Option<Cow<'a, V>>,
}Expand description
A SQL parameter that associates a value with a placeholder. Designed to be const-friendly and zero-cost when possible.
Fields§
§placeholder: PlaceholderThe placeholder to use in the SQL
value: Option<Cow<'a, V>>The value to bind
Implementations§
Source§impl<'a, V: SQLParam> Param<'a, V>
impl<'a, V: SQLParam> Param<'a, V>
pub fn new(placeholder: Placeholder, value: Option<Cow<'a, V>>) -> Self
Source§impl<'a, T: SQLParam> Param<'a, T>
impl<'a, T: SQLParam> Param<'a, T>
Sourcepub const fn positional(value: T) -> Self
pub const fn positional(value: T) -> Self
Creates a new parameter with a positional placeholder
Sourcepub const fn from_placeholder(placeholder: Placeholder) -> Self
pub const fn from_placeholder(placeholder: Placeholder) -> Self
Creates a new parameter with a specific placeholder and no value
Sourcepub const fn named(name: &'static str, value: T) -> Self
pub const fn named(name: &'static str, value: T) -> Self
Creates a new parameter with a named placeholder (colon style)
Sourcepub const fn with_placeholder(placeholder: Placeholder, value: T) -> Self
pub const fn with_placeholder(placeholder: Placeholder, value: T) -> Self
Creates a new parameter with a specific placeholder
Trait Implementations§
Source§impl<'a, V: SQLParam> From<&'a OwnedParam<V>> for Param<'a, V>
impl<'a, V: SQLParam> From<&'a OwnedParam<V>> for Param<'a, V>
Source§fn from(value: &'a OwnedParam<V>) -> Self
fn from(value: &'a OwnedParam<V>) -> Self
Converts to this type from the input type.
Source§impl<'a, V: SQLParam> From<OwnedParam<V>> for Param<'a, V>
impl<'a, V: SQLParam> From<OwnedParam<V>> for Param<'a, V>
Source§fn from(value: OwnedParam<V>) -> Self
fn from(value: OwnedParam<V>) -> Self
Converts to this type from the input type.
Source§impl<'a, V: SQLParam> From<Placeholder> for Param<'a, V>
impl<'a, V: SQLParam> From<Placeholder> for Param<'a, V>
Source§fn from(value: Placeholder) -> Self
fn from(value: Placeholder) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'a, V> Freeze for Param<'a, V>where
V: Freeze,
impl<'a, V> RefUnwindSafe for Param<'a, V>where
V: RefUnwindSafe,
impl<'a, V> Send for Param<'a, V>
impl<'a, V> Sync for Param<'a, V>where
V: Sync,
impl<'a, V> Unpin for Param<'a, V>where
V: Unpin,
impl<'a, V> UnwindSafe for Param<'a, V>where
V: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more