mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 13:02:07 +03:00
Fix compilation error when building single graph_editor crate (#3319)
@akavel spotted a compilation error, when building test for graph_editor crate. The cause was that: * prelude without serde still added serde derivatives in im_string_newtype * and the graph_editor needs serde from prelude anyway (because it wants to have serializable ImStrings).
This commit is contained in:
parent
28be22fea5
commit
5b7576f53a
@ -15,7 +15,7 @@ bimap = { version = "0.4.0" }
|
||||
enso-config = { version = "0.1.0", path = "../../config" }
|
||||
enso-frp = { version = "0.1.0", path = "../../../../lib/rust/frp" }
|
||||
enso-logger = { path = "../../../../lib/rust/logger"}
|
||||
enso-prelude = { path = "../../../../lib/rust/prelude"}
|
||||
enso-prelude = { path = "../../../../lib/rust/prelude", features = ["serde"] }
|
||||
engine-protocol = { version = "0.1.0", path = "../../controller/engine-protocol" }
|
||||
enso-shapely = { path = "../../../../lib/rust/shapely"}
|
||||
enso-text = { version = "0.1.0", path = "../../../../lib/rust/text" }
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! Module for utilities related to serialization/deserialization using the `serde` library.
|
||||
|
||||
#[cfg(feature = "serde_json")]
|
||||
use serde::Deserialize;
|
||||
use serde::Deserializer;
|
||||
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ use serde::Deserializer;
|
||||
pub fn deserialize_or_default<'d, Ret, D>(d: D) -> Result<Ret, D::Error>
|
||||
where
|
||||
for<'e> Ret: Default + Deserialize<'e>,
|
||||
D: Deserializer<'d>, {
|
||||
D: serde::Deserializer<'d>, {
|
||||
// We first parse as generic JSON value. This is necessary to consume parser input.
|
||||
// If we just tried parsing the desired type directly and ignored error, we would end up with
|
||||
// `trailing characters` error in non-trivial cases.
|
||||
|
@ -217,12 +217,32 @@ impl PartialEq<ImString> for String {
|
||||
// === Macros ===
|
||||
|
||||
/// Defines a newtype for `ImString`.
|
||||
#[cfg(not(feature = "serde"))]
|
||||
#[macro_export]
|
||||
macro_rules! im_string_newtype {
|
||||
($($(#$meta:tt)* $name:ident),* $(,)?) => {
|
||||
im_string_newtype_without_serde!{ $($(#$meta)* $name),* }
|
||||
};
|
||||
}
|
||||
|
||||
/// Defines a newtype for `ImString`.
|
||||
#[cfg(feature = "serde")]
|
||||
#[macro_export]
|
||||
macro_rules! im_string_newtype {
|
||||
($($(#$meta:tt)* $name:ident),* $(,)?) => {
|
||||
im_string_newtype_without_serde!{ $(
|
||||
#[derive($crate::serde_reexports::Serialize,$crate::serde_reexports::Deserialize)]
|
||||
$(#$meta)* $name
|
||||
),* }
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! im_string_newtype_without_serde {
|
||||
($($(#$meta:tt)* $name:ident),* $(,)?) => {$(
|
||||
$(#$meta)*
|
||||
#[derive(Clone,CloneRef,Debug,Default,Eq,Hash,PartialEq)]
|
||||
#[derive($crate::serde_reexports::Serialize,$crate::serde_reexports::Deserialize)]
|
||||
|
||||
pub struct $name {
|
||||
content : ImString
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user