Skip to content

Commit

Permalink
fix: circular dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko committed Feb 22, 2024
1 parent ddc3393 commit f4013c5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 59 deletions.
2 changes: 0 additions & 2 deletions convert/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ serde_json = "1.0.105"
extism-convert-macros.workspace = true

[dev-dependencies]
# Only required for tests run from the workspace root, as that enables the `extism-path` feature.
extism.workspace = true
serde = { version = "1.0.186", features = ["derive"] }

[features]
Expand Down
13 changes: 1 addition & 12 deletions convert/src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,7 @@ use base64::Engine;
/// For example, the following line creates a new JSON encoding using serde_json:
///
/// ```
#[cfg_attr(
feature = "extism-path",
doc = "extism::convert::encoding!(MyJson, serde_json::to_vec, serde_json::from_slice);"
)]
#[cfg_attr(
all(feature = "extism-pdk-path", not(feature = "extism-path")),
doc = "extism_pdk::encoding!(MyJson, serde_json::to_vec, serde_json::from_slice);"
)]
#[cfg_attr(
not(any(feature = "extism-path", feature = "extism-pdk-path")),
doc = "extism_convert::encoding!(MyJson, serde_json::to_vec, serde_json::from_slice);"
)]
/// extism_convert::encoding!(MyJson, serde_json::to_vec, serde_json::from_slice);
/// ```
///
/// This will create a struct `struct MyJson<T>(pub T)` and implement [`ToBytes`] using [`serde_json::to_vec`]
Expand Down
26 changes: 2 additions & 24 deletions convert/src/from_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,7 @@ pub use extism_convert_macros::FromBytes;
/// `FromBytes`, e.g., [`Json`], [`Msgpack`].
///
/// ```
#[cfg_attr(
feature = "extism-path",
doc = "use extism::convert::{Json, FromBytes};"
)]
#[cfg_attr(
all(feature = "extism-pdk-path", not(feature = "extism-path")),
doc = "use extism_pdk::{Json, FromBytes};"
)]
#[cfg_attr(
not(any(feature = "extism-path", feature = "extism-pdk-path")),
doc = "use extism_convert::{Json, FromBytes};"
)]
/// use extism_convert::{Json, FromBytes};
/// use serde::Deserialize;
///
/// #[derive(FromBytes, Deserialize, PartialEq, Debug)]
Expand All @@ -39,18 +28,7 @@ pub use extism_convert_macros::FromBytes;
/// ```
/// use std::str::{self, FromStr};
/// use std::convert::Infallible;
#[cfg_attr(
feature = "extism-path",
doc = "use extism::convert::{Error, FromBytes, FromBytesOwned};"
)]
#[cfg_attr(
all(feature = "extism-pdk-path", not(feature = "extism-path")),
doc = "use extism_pdk::{Error, FromBytes, FromBytesOwned};"
)]
#[cfg_attr(
not(any(feature = "extism-path", feature = "extism-pdk-path")),
doc = "use extism_convert::{Error, FromBytes, FromBytesOwned};"
)]
/// use extism_convert::{Error, FromBytes, FromBytesOwned};
///
/// // Custom serialization using `FromStr`
/// struct StringEnc<T>(T);
Expand Down
23 changes: 2 additions & 21 deletions convert/src/to_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@ pub use extism_convert_macros::ToBytes;
/// `ToBytes`, e.g., [`Json`], [`Msgpack`].
///
/// ```
#[cfg_attr(feature = "extism-path", doc = "use extism::convert::{Json, ToBytes};")]
#[cfg_attr(
all(feature = "extism-pdk-path", not(feature = "extism-path")),
doc = "use extism_pdk::{Json, ToBytes};"
)]
#[cfg_attr(
not(any(feature = "extism-path", feature = "extism-pdk-path")),
doc = "use extism_convert::{Json, ToBytes};"
)]
/// use extism_convert::{Json, ToBytes};
/// use serde::Serialize;
///
/// #[derive(ToBytes, Serialize)]
Expand All @@ -34,18 +26,7 @@ pub use extism_convert_macros::ToBytes;
/// generic argument, i.e., `Type<T>(T)`, that implement `ToBytes` for the struct.
///
/// ```
#[cfg_attr(
feature = "extism-path",
doc = "use extism::convert::{Error, ToBytes};"
)]
#[cfg_attr(
all(feature = "extism-pdk-path", not(feature = "extism-path")),
doc = "use extism_pdk::{Error, ToBytes};"
)]
#[cfg_attr(
not(any(feature = "extism-path", feature = "extism-pdk-path")),
doc = "use extism_convert::{Error, ToBytes};"
)]
/// use extism_convert::{Error, ToBytes};
///
/// // Custom serialization using `ToString`
/// struct StringEnc<T>(T);
Expand Down

0 comments on commit f4013c5

Please sign in to comment.