Skip to content

Instantly share code, notes, and snippets.

@TheDrawingCoder-Gamer
Created July 18, 2023 22:48
Show Gist options
  • Save TheDrawingCoder-Gamer/807ceb174267ce88c28599cf20610793 to your computer and use it in GitHub Desktop.
Save TheDrawingCoder-Gamer/807ceb174267ce88c28599cf20610793 to your computer and use it in GitHub Desktop.
Sample of a struct
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Object<Kind> {
/// Identifies a resource attached or related to an object that potentially requires special
/// handling.
///
/// The intent is to provide a model that is at least semantically similar to attachments in
/// email.
///
/// - Range: Object | Link
/// - Functional: false
#[serde(skip_serializing_if = "Option::is_none")]
attachment: Option<OneOrMany<AnyBase>>,
/// Base fields and unparsed json ends up here
#[serde(flatten)]
inner: Base<Kind>,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment