Created
December 10, 2021 21:00
-
-
Save amcsi/f25e270e8e208e0cd8e350bcc97f9d4f to your computer and use it in GitHub Desktop.
Rust code needing deduplication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl<'a> SerializingCommon<'a> { | |
pub fn serialize_page<T>(serialized: &SerializingPage) -> SerializingCommon<'a> | |
{ | |
SerializingCommon { | |
ancestors: &serialized.ancestors, | |
assets: serialized.assets, | |
components: serialized.components, | |
content: serialized.content, | |
description: serialized.description, | |
draft: serialized.draft, | |
extra: serialized.extra, | |
lang: serialized.lang, | |
path: serialized.path, | |
permalink: serialized.permalink, | |
reading_time: serialized.reading_time, | |
relative_path: serialized.relative_path, | |
title: serialized.title, | |
toc: serialized.toc, | |
translations: &serialized.translations, | |
word_count: serialized.word_count, | |
} | |
} | |
pub fn serialize_section<T>(serialized: &SerializingSection) -> SerializingCommon<'a> | |
{ | |
SerializingCommon { | |
ancestors: &serialized.ancestors, | |
assets: serialized.assets, | |
components: serialized.components, | |
content: serialized.content, | |
description: serialized.description, | |
draft: serialized.draft, | |
extra: serialized.extra, | |
lang: serialized.lang, | |
path: serialized.path, | |
permalink: serialized.permalink, | |
reading_time: serialized.reading_time, | |
relative_path: serialized.relative_path, | |
title: serialized.title, | |
toc: serialized.toc, | |
translations: &serialized.translations, | |
word_count: serialized.word_count, | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment