summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Korber <p.korber@1aim.com>2018-08-24 21:24:01 +0200
committerPhilipp Korber <p.korber@1aim.com>2018-08-24 21:24:01 +0200
commitd2304b8f7496b5653187bed332ba6c429e37248a (patch)
treec1a9626cf30b61b22a57bd0777bb13d12c1c9feb
parent9e40e2afb0be5d3e76f8186f53b9562f2e8d7d1f (diff)
refactor(Embedded) changed serd related feature name
- `serialize-content-id` => `serialize-to-content-id`
-rw-r--r--Cargo.toml2
-rw-r--r--src/lib.rs2
-rw-r--r--src/resource/mod.rs8
3 files changed, 8 insertions, 4 deletions
diff --git a/Cargo.toml b/Cargo.toml
index d6114ce..e13195e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -39,4 +39,4 @@ optional = true
[features]
default = []
askama-engine = ["askama"]
-serialize-content-id = ["serde"] \ No newline at end of file
+serialize-to-content-id = ["serde"] \ No newline at end of file
diff --git a/src/lib.rs b/src/lib.rs
index 6d4f430..58f187a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,7 +11,7 @@ extern crate soft_ascii_string;
#[macro_use]
extern crate vec1;
-#[cfg(feature="serialize-content-id")]
+#[cfg(feature="serialize-to-content-id")]
extern crate serde;
#[cfg(feature="askama-engine")]
diff --git a/src/resource/mod.rs b/src/resource/mod.rs
index 3f16a96..a22f663 100644
--- a/src/resource/mod.rs
+++ b/src/resource/mod.rs
@@ -75,13 +75,17 @@ impl Embedded {
self.content_id().unwrap()
}
+ /// Generate and set a new content id if needed and additionally clone the type into an `EmbeddedWithCId` instance.
+ ///
+ /// Given that `Resource` instances are meant to be cheap to clone this should not be very
+ /// expansive (at last if no new content is generated).
pub fn assure_content_id_and_copy(&mut self, ctx: &impl Context) -> EmbeddedWithCId {
self.assure_content_id(ctx);
EmbeddedWithCId { inner: self.clone() }
}
}
-#[cfg(feature="serialize-content-id")]
+#[cfg(feature="serialize-to-content-id")]
impl<'a> Serialize for Embedded {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer
@@ -268,7 +272,7 @@ impl EmbeddedWithCId {
}
}
-#[cfg(feature="serialize-content-id")]
+#[cfg(feature="serialize-to-content-id")]
impl<'a> Serialize for EmbeddedWithCId {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer