AnchorImpl was a wrapper created to allow the implementation of foreign
traits, like From/ToJson from serde_json for external unknown structs
implementing the Anchor trait.
As the Anchor generic in the rusqlite implementation for anchored
ChangeSets was the only place where this AnchorImpl was used and it has
been fixed to the anchor ConfirmationBlockTime, there is no more reason
to keep this wrapper around.
&self.0
}
}
-
-/// A wrapper that we use to impl remote traits for types in our crate or dependency crates that impl [`Anchor`].
-pub struct AnchorImpl<T>(pub T);
-
-impl<T> AnchorImpl<T> {
- /// Returns the inner `T`.
- pub fn into_inner(self) -> T {
- self.0
- }
-}
-
-impl<T> From<T> for AnchorImpl<T> {
- fn from(value: T) -> Self {
- Self(value)
- }
-}
-
-impl<T> core::ops::Deref for AnchorImpl<T> {
- type Target = T;
-
- fn deref(&self) -> &Self::Target {
- &self.0
- }
-}
}
}
-impl<A: Anchor + serde::de::DeserializeOwned> FromSql for AnchorImpl<A> {
- fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self> {
- serde_json::from_str(value.as_str()?)
- .map(AnchorImpl)
- .map_err(from_sql_error)
- }
-}
-
-impl<A: Anchor + serde::Serialize> ToSql for AnchorImpl<A> {
- fn to_sql(&self) -> rusqlite::Result<ToSqlOutput<'_>> {
- serde_json::to_string(&self.0)
- .map(Into::into)
- .map_err(to_sql_error)
- }
-}
-
#[cfg(feature = "miniscript")]
impl FromSql for Impl<miniscript::Descriptor<miniscript::DescriptorPublicKey>> {
fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self> {