huskies: merge 963
This commit is contained in:
@@ -134,7 +134,11 @@ pub struct Claim {
|
||||
/// The numeric prefix of the epic's story_id (e.g. `EpicId(9990)` for the
|
||||
/// epic whose CRDT story_id register holds `"9990"`). Epics are always
|
||||
/// created with a pure-numeric story_id by `create_epic_file`.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
///
|
||||
/// Serialises as a decimal string (`"9990"`) so JSON consumers see a stable
|
||||
/// string identifier regardless of whether the inner value fits in a JS integer.
|
||||
/// Deserialises from a decimal string.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct EpicId(pub u32);
|
||||
|
||||
impl EpicId {
|
||||
@@ -158,6 +162,21 @@ impl std::fmt::Display for EpicId {
|
||||
}
|
||||
}
|
||||
|
||||
impl serde::Serialize for EpicId {
|
||||
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
serializer.serialize_str(&self.0.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> serde::Deserialize<'de> for EpicId {
|
||||
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||
let s = String::deserialize(deserializer)?;
|
||||
s.parse::<u32>()
|
||||
.map(EpicId)
|
||||
.map_err(serde::de::Error::custom)
|
||||
}
|
||||
}
|
||||
|
||||
/// A typed snapshot of a single pipeline work item derived from the CRDT document.
|
||||
///
|
||||
/// Access fields exclusively through the typed accessor methods — raw field access is
|
||||
|
||||
Reference in New Issue
Block a user