pub struct SqlServerLiteralWrapper<T: SqlServerLiteral>(/* private fields */);Expand description
A wrapper type for any value implementing SqlServerLiteral.
This type allows you to easily convert a value into one that implements both Display and serde::Serialize, enabling SQL Server literal behavior.
§Examples
use mssql_value_serializer::SqlServerLiteralWrapper;
let needle = "Some text";
let mut sql = format!(
"
SELECT
*
FROM
[TABLE]
WHERE
name = {value}
",
value = SqlServerLiteralWrapper::new(needle)
);
assert_eq!(
"
SELECT
*
FROM
[TABLE]
WHERE
name = N'Some text'
",
sql
);Implementations§
Source§impl<T: SqlServerLiteral> SqlServerLiteralWrapper<T>
impl<T: SqlServerLiteral> SqlServerLiteralWrapper<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: Clone + SqlServerLiteral> Clone for SqlServerLiteralWrapper<T>
impl<T: Clone + SqlServerLiteral> Clone for SqlServerLiteralWrapper<T>
Source§fn clone(&self) -> SqlServerLiteralWrapper<T>
fn clone(&self) -> SqlServerLiteralWrapper<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug + SqlServerLiteral> Debug for SqlServerLiteralWrapper<T>
impl<T: Debug + SqlServerLiteral> Debug for SqlServerLiteralWrapper<T>
Source§impl<T: SqlServerLiteral> Deref for SqlServerLiteralWrapper<T>
impl<T: SqlServerLiteral> Deref for SqlServerLiteralWrapper<T>
Source§impl<T: SqlServerLiteral> Display for SqlServerLiteralWrapper<T>
impl<T: SqlServerLiteral> Display for SqlServerLiteralWrapper<T>
Source§impl<T: SqlServerLiteral> From<T> for SqlServerLiteralWrapper<T>
impl<T: SqlServerLiteral> From<T> for SqlServerLiteralWrapper<T>
Source§impl<T: Hash + SqlServerLiteral> Hash for SqlServerLiteralWrapper<T>
impl<T: Hash + SqlServerLiteral> Hash for SqlServerLiteralWrapper<T>
Source§impl<T: Ord + SqlServerLiteral> Ord for SqlServerLiteralWrapper<T>
impl<T: Ord + SqlServerLiteral> Ord for SqlServerLiteralWrapper<T>
Source§fn cmp(&self, other: &SqlServerLiteralWrapper<T>) -> Ordering
fn cmp(&self, other: &SqlServerLiteralWrapper<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialEq + SqlServerLiteral> PartialEq for SqlServerLiteralWrapper<T>
impl<T: PartialEq + SqlServerLiteral> PartialEq for SqlServerLiteralWrapper<T>
Source§impl<T: PartialOrd + SqlServerLiteral> PartialOrd for SqlServerLiteralWrapper<T>
impl<T: PartialOrd + SqlServerLiteral> PartialOrd for SqlServerLiteralWrapper<T>
Source§impl<T: SqlServerLiteral> Serialize for SqlServerLiteralWrapper<T>
Available on crate feature serde only.
impl<T: SqlServerLiteral> Serialize for SqlServerLiteralWrapper<T>
Available on crate feature
serde only.Source§impl<T: SqlServerLiteral> SqlServerLiteral for SqlServerLiteralWrapper<T>
impl<T: SqlServerLiteral> SqlServerLiteral for SqlServerLiteralWrapper<T>
Source§fn append_sql_literal(&self, out: &mut String) -> Result<(), SqlLiteralError>
fn append_sql_literal(&self, out: &mut String) -> Result<(), SqlLiteralError>
Appends the SQL literal representation of this value to the given string.
Source§fn append_sql_literal_fmt(
&self,
out: &mut Formatter<'_>,
) -> Result<(), SqlLiteralError>
fn append_sql_literal_fmt( &self, out: &mut Formatter<'_>, ) -> Result<(), SqlLiteralError>
Appends the SQL literal representation of this value to the given writer.
impl<T: Copy + SqlServerLiteral> Copy for SqlServerLiteralWrapper<T>
impl<T: Eq + SqlServerLiteral> Eq for SqlServerLiteralWrapper<T>
impl<T: SqlServerLiteral> StructuralPartialEq for SqlServerLiteralWrapper<T>
Auto Trait Implementations§
impl<T> Freeze for SqlServerLiteralWrapper<T>where
T: Freeze,
impl<T> RefUnwindSafe for SqlServerLiteralWrapper<T>where
T: RefUnwindSafe,
impl<T> Send for SqlServerLiteralWrapper<T>where
T: Send,
impl<T> Sync for SqlServerLiteralWrapper<T>where
T: Sync,
impl<T> Unpin for SqlServerLiteralWrapper<T>where
T: Unpin,
impl<T> UnwindSafe for SqlServerLiteralWrapper<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