pub struct CodeSnippet {
pub content: String,
pub language: Option<String>,
pub name: Option<String>,
pub extension: Option<String>,
pub description: Option<String>,
pub runtime: Option<String>,
pub licenses: Vec<String>,
pub dependencies: Vec<String>,
pub repos: Vec<CodeRepo>,
pub extra_tags: Vec<Tag>,
}Expand description
Typed bundle for a kind: 1337 code-snippet event.
Fields§
§content: StringThe actual code body.
language: Option<String>l programming language token (lower-case per spec).
name: Option<String>name (commonly a filename).
extension: Option<String>extension (without the leading dot).
description: Option<String>description line.
runtime: Option<String>runtime specifier.
licenses: Vec<String>license SPDX identifiers (multi-licensing supported).
dependencies: Vec<String>dep dependency lines (repeatable).
repos: Vec<CodeRepo>repo references (URL or NIP-34 coordinate).
Forward-compatible passthrough for unknown tags.
Implementations§
Source§impl CodeSnippet
impl CodeSnippet
Sourcepub fn from_event(event: &Event) -> Result<Self, CodeSnippetError>
pub fn from_event(event: &Event) -> Result<Self, CodeSnippetError>
Trait Implementations§
Source§impl Clone for CodeSnippet
impl Clone for CodeSnippet
Source§fn clone(&self) -> CodeSnippet
fn clone(&self) -> CodeSnippet
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CodeSnippet
impl Debug for CodeSnippet
Source§impl Default for CodeSnippet
impl Default for CodeSnippet
Source§fn default() -> CodeSnippet
fn default() -> CodeSnippet
Returns the “default value” for a type. Read more
impl Eq for CodeSnippet
Source§impl PartialEq for CodeSnippet
impl PartialEq for CodeSnippet
impl StructuralPartialEq for CodeSnippet
Auto Trait Implementations§
impl Freeze for CodeSnippet
impl RefUnwindSafe for CodeSnippet
impl Send for CodeSnippet
impl Sync for CodeSnippet
impl Unpin for CodeSnippet
impl UnsafeUnpin for CodeSnippet
impl UnwindSafe for CodeSnippet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.