pub struct TextWrapper<T>(pub T);Expand description
Wrapper type for implementing sqlx Encode and Decode for types by converting them to and from text.
Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: Debug> Debug for TextWrapper<T>
impl<T: Debug> Debug for TextWrapper<T>
Source§impl<'r> Decode<'r, Sqlite> for TextWrapper<Address>
impl<'r> Decode<'r, Sqlite> for TextWrapper<Address>
Source§fn decode(value: SqliteValueRef<'r>) -> Result<Self, BoxDynError>
fn decode(value: SqliteValueRef<'r>) -> Result<Self, BoxDynError>
Decode a new value of this type using a raw value from the database.
Source§impl<'r, const N: usize> Decode<'r, Sqlite> for TextWrapper<FixedBytes<N>>
impl<'r, const N: usize> Decode<'r, Sqlite> for TextWrapper<FixedBytes<N>>
Source§fn decode(value: SqliteValueRef<'r>) -> Result<Self, BoxDynError>
fn decode(value: SqliteValueRef<'r>) -> Result<Self, BoxDynError>
Decode a new value of this type using a raw value from the database.
Source§impl<'r, const BITS: usize, const LIMBS: usize> Decode<'r, Sqlite> for TextWrapper<Uint<BITS, LIMBS>>
impl<'r, const BITS: usize, const LIMBS: usize> Decode<'r, Sqlite> for TextWrapper<Uint<BITS, LIMBS>>
Source§fn decode(value: SqliteValueRef<'r>) -> Result<Self, BoxDynError>
fn decode(value: SqliteValueRef<'r>) -> Result<Self, BoxDynError>
Decode a new value of this type using a raw value from the database.
Source§impl Encode<'_, Sqlite> for TextWrapper<Address>
impl Encode<'_, Sqlite> for TextWrapper<Address>
Source§fn encode_by_ref(
&self,
args: &mut Vec<SqliteArgumentValue<'_>>,
) -> Result<IsNull, BoxDynError>
fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'_>>, ) -> Result<IsNull, BoxDynError>
Source§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
Writes the value of
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
Source§impl<const N: usize> Encode<'_, Sqlite> for TextWrapper<FixedBytes<N>>
impl<const N: usize> Encode<'_, Sqlite> for TextWrapper<FixedBytes<N>>
Source§fn encode_by_ref(
&self,
args: &mut Vec<SqliteArgumentValue<'_>>,
) -> Result<IsNull, BoxDynError>
fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'_>>, ) -> Result<IsNull, BoxDynError>
Source§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
Writes the value of
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
Source§impl<const BITS: usize, const LIMBS: usize> Encode<'_, Sqlite> for TextWrapper<Uint<BITS, LIMBS>>
impl<const BITS: usize, const LIMBS: usize> Encode<'_, Sqlite> for TextWrapper<Uint<BITS, LIMBS>>
Source§fn encode_by_ref(
&self,
args: &mut Vec<SqliteArgumentValue<'_>>,
) -> Result<IsNull, BoxDynError>
fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'_>>, ) -> Result<IsNull, BoxDynError>
Source§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
Writes the value of
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
Source§impl Type<Sqlite> for TextWrapper<Address>
impl Type<Sqlite> for TextWrapper<Address>
Source§fn type_info() -> SqliteTypeInfo
fn type_info() -> SqliteTypeInfo
Returns the canonical SQL type for this Rust type. Read more
Source§fn compatible(ty: &SqliteTypeInfo) -> bool
fn compatible(ty: &SqliteTypeInfo) -> bool
Determines if this Rust type is compatible with the given SQL type. Read more
Source§impl<const N: usize> Type<Sqlite> for TextWrapper<FixedBytes<N>>
impl<const N: usize> Type<Sqlite> for TextWrapper<FixedBytes<N>>
Source§fn type_info() -> SqliteTypeInfo
fn type_info() -> SqliteTypeInfo
Returns the canonical SQL type for this Rust type. Read more
Source§fn compatible(ty: &SqliteTypeInfo) -> bool
fn compatible(ty: &SqliteTypeInfo) -> bool
Determines if this Rust type is compatible with the given SQL type. Read more
Source§impl<const BITS: usize, const LIMBS: usize> Type<Sqlite> for TextWrapper<Uint<BITS, LIMBS>>
impl<const BITS: usize, const LIMBS: usize> Type<Sqlite> for TextWrapper<Uint<BITS, LIMBS>>
Source§fn type_info() -> SqliteTypeInfo
fn type_info() -> SqliteTypeInfo
Returns the canonical SQL type for this Rust type. Read more
Source§fn compatible(ty: &SqliteTypeInfo) -> bool
fn compatible(ty: &SqliteTypeInfo) -> bool
Determines if this Rust type is compatible with the given SQL type. Read more
Auto Trait Implementations§
impl<T> Freeze for TextWrapper<T>where
T: Freeze,
impl<T> RefUnwindSafe for TextWrapper<T>where
T: RefUnwindSafe,
impl<T> Send for TextWrapper<T>where
T: Send,
impl<T> Sync for TextWrapper<T>where
T: Sync,
impl<T> Unpin for TextWrapper<T>where
T: Unpin,
impl<T> UnsafeUnpin for TextWrapper<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for TextWrapper<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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more