pub struct SqlServerLiteralForValueListWrapper<T: SqlServerLiteralForValueList>(/* private fields */);Expand description
A wrapper type for any value implementing SqlServerLiteralForValueList.
This type allows you to easily convert a value into one that implements both Display and serde::Serialize, enabling it to exhibit SQL Server literal value list behavior.
§Examples
use mssql_value_serializer::{SqlServerLiteral, SqlServerLiteralForValueListWrapper};
let needles: &[&str] = &["Some text", "Foo", "Bar"];
let mut sql = format!(
"
SELECT
*
FROM
[TABLE]
WHERE
name IN ({value})
",
value = SqlServerLiteralForValueListWrapper::new(needles)
);
assert_eq!(
"
SELECT
*
FROM
[TABLE]
WHERE
name IN (N'Some text', N'Foo', N'Bar')
",
sql
);Implementations§
Source§impl<T: SqlServerLiteralForValueList> SqlServerLiteralForValueListWrapper<T>
impl<T: SqlServerLiteralForValueList> SqlServerLiteralForValueListWrapper<T>
pub const fn new(value: T) -> Self
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the wrapper and returns the inner value.
Trait Implementations§
Source§impl<T: SqlServerLiteralForValueList> From<T> for SqlServerLiteralForValueListWrapper<T>
impl<T: SqlServerLiteralForValueList> From<T> for SqlServerLiteralForValueListWrapper<T>
Source§impl<T: SqlServerLiteralForValueList> Serialize for SqlServerLiteralForValueListWrapper<T>
Available on crate feature serde only.
impl<T: SqlServerLiteralForValueList> Serialize for SqlServerLiteralForValueListWrapper<T>
Available on crate feature
serde only.Source§impl<T: SqlServerLiteralForValueList> SqlServerLiteralForValueList for SqlServerLiteralForValueListWrapper<T>
impl<T: SqlServerLiteralForValueList> SqlServerLiteralForValueList for SqlServerLiteralForValueListWrapper<T>
Source§fn append_sql_literal_for_value_list(
&self,
out: &mut String,
) -> Result<(), SqlLiteralError>
fn append_sql_literal_for_value_list( &self, out: &mut String, ) -> Result<(), SqlLiteralError>
Appends a comma-separated list of SQL Server literals representing the elements of this collection to the provided output string.
Source§fn append_sql_literal_for_value_list_fmt(
&self,
out: &mut Formatter<'_>,
) -> Result<(), SqlLiteralError>
fn append_sql_literal_for_value_list_fmt( &self, out: &mut Formatter<'_>, ) -> Result<(), SqlLiteralError>
Appends a comma-separated list of SQL Server literals representing the elements of this collection to the provided output writer.
Auto Trait Implementations§
impl<T> Freeze for SqlServerLiteralForValueListWrapper<T>where
T: Freeze,
impl<T> RefUnwindSafe for SqlServerLiteralForValueListWrapper<T>where
T: RefUnwindSafe,
impl<T> Send for SqlServerLiteralForValueListWrapper<T>where
T: Send,
impl<T> Sync for SqlServerLiteralForValueListWrapper<T>where
T: Sync,
impl<T> Unpin for SqlServerLiteralForValueListWrapper<T>where
T: Unpin,
impl<T> UnwindSafe for SqlServerLiteralForValueListWrapper<T>where
T: UnwindSafe,
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