pub struct SqlLiteral<'a>(pub &'a str);Expand description
A wrapper that ensures a SQL string literal is properly escaped when formatted.
This wraps the string in single quotes and escapes any internal single quotes.
§Example
// Marked `no_run` to dodge a Windows Defender heuristic that intermittently
// refuses to launch this specific compiled doctest binary with
// `ERROR_ACCESS_DENIED`. The same assertions are exercised by
// `tests::test_sql_literal_display` so coverage is preserved.
use hyperdb_api_core::protocol::escape::SqlLiteral;
assert_eq!(format!("{}", SqlLiteral("hello")), "'hello'");
assert_eq!(format!("{}", SqlLiteral("it's")), "'it''s'");Tuple Fields§
§0: &'a strTrait Implementations§
Source§impl<'a> Clone for SqlLiteral<'a>
impl<'a> Clone for SqlLiteral<'a>
Source§fn clone(&self) -> SqlLiteral<'a>
fn clone(&self) -> SqlLiteral<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for SqlLiteral<'a>
impl<'a> Debug for SqlLiteral<'a>
Source§impl Display for SqlLiteral<'_>
impl Display for SqlLiteral<'_>
impl<'a> Copy for SqlLiteral<'a>
Auto Trait Implementations§
impl<'a> Freeze for SqlLiteral<'a>
impl<'a> RefUnwindSafe for SqlLiteral<'a>
impl<'a> Send for SqlLiteral<'a>
impl<'a> Sync for SqlLiteral<'a>
impl<'a> Unpin for SqlLiteral<'a>
impl<'a> UnsafeUnpin for SqlLiteral<'a>
impl<'a> UnwindSafe for SqlLiteral<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request