pub struct Meta {
pub name: String,
pub description: String,
pub tags: Vec<String>,
pub language: FileType,
pub created: DateTime<Utc>,
pub modified: DateTime<Utc>,
pub visibility: Visibility,
}
Expand description
Metadata associated with a snippet.
Includes name, description, tags, programming language, creation and modification timestamps, as well as visibility status (e.g., public, private).
Fields§
§name: String
Name of the snippet (used for display and slug generation).
description: String
Short description of the snippet’s purpose or context.
Tags associated with the snippet, e.g. ["sql", "orm", "diesel"]
.
language: FileType
Language or file type of the snippet (e.g. rust
, bash
, sql
).
created: DateTime<Utc>
Timestamp indicating when the snippet was created (UTC).
modified: DateTime<Utc>
Timestamp indicating when the snippet was last modified (UTC).
visibility: Visibility
Visibility status (e.g. Private
, Public
, Archived
). Defaults to Private
.
Implementations§
Source§impl Meta
impl Meta
Sourcepub fn new(
name: String,
description: String,
tags: Vec<String>,
language: FileType,
visibility: Option<Visibility>,
) -> Self
pub fn new( name: String, description: String, tags: Vec<String>, language: FileType, visibility: Option<Visibility>, ) -> Self
Creates a new Meta
object with the current timestamp for created
and modified
.
If no visibility is provided, defaults to Private
.
Sourcepub fn get_content_extension(&self) -> String
pub fn get_content_extension(&self) -> String
Returns the standard file extension (without a dot) for the snippet’s language.