pub enum SkillFormat {
Markdown,
Json,
}Expand description
Supported import and export formats for skill documents.
MentisDB stores every skill as a SkillVersionContent::Full raw string in the
format it was uploaded in. The registry can round-trip any skill through either
format: upload in Markdown, read back as JSON (or vice-versa) via
SkillRegistry::read_skill.
§Examples
use mentisdb::SkillFormat;
use std::str::FromStr;
// Display gives the canonical lowercase name.
assert_eq!(SkillFormat::Markdown.to_string(), "markdown");
assert_eq!(SkillFormat::Json.to_string(), "json");
// Both "md" and "markdown" parse as Markdown.
assert_eq!("md".parse::<SkillFormat>().unwrap(), SkillFormat::Markdown);
assert_eq!("json".parse::<SkillFormat>().unwrap(), SkillFormat::Json);
// Unknown strings return an error.
assert!("xml".parse::<SkillFormat>().is_err());Variants§
Markdown
Markdown skill document with optional YAML-like frontmatter.
The Markdown parser recognises an optional --- … --- frontmatter block
at the top of the file that may carry name, description, tags,
triggers, and warnings key-value pairs. Everything after the
frontmatter block is parsed into SkillSections by heading level.
Json
JSON representation of the structured SkillDocument object.
The JSON format is a direct serde_json serialisation of SkillDocument.
It is useful for programmatic consumption or when the skill content is
already available as a structured object rather than freeform Markdown.
Implementations§
Trait Implementations§
Source§impl Clone for SkillFormat
impl Clone for SkillFormat
Source§fn clone(&self) -> SkillFormat
fn clone(&self) -> SkillFormat
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SkillFormat
impl Debug for SkillFormat
Source§impl<'de> Deserialize<'de> for SkillFormat
impl<'de> Deserialize<'de> for SkillFormat
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for SkillFormat
impl Display for SkillFormat
Source§impl FromStr for SkillFormat
impl FromStr for SkillFormat
Source§impl Hash for SkillFormat
impl Hash for SkillFormat
Source§impl PartialEq for SkillFormat
impl PartialEq for SkillFormat
Source§impl Serialize for SkillFormat
impl Serialize for SkillFormat
impl Copy for SkillFormat
impl Eq for SkillFormat
impl StructuralPartialEq for SkillFormat
Auto Trait Implementations§
impl Freeze for SkillFormat
impl RefUnwindSafe for SkillFormat
impl Send for SkillFormat
impl Sync for SkillFormat
impl Unpin for SkillFormat
impl UnsafeUnpin for SkillFormat
impl UnwindSafe for SkillFormat
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
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
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.