Skip to main content

Synx

Struct Synx 

Source
pub struct Synx;
Expand description

Main entry point for the SYNX parser.

Implementations§

Source§

impl Synx

Source

pub fn parse(text: &str) -> HashMap<String, Value>

Parse a SYNX string into a key-value map (static mode only).

Source

pub fn parse_active(text: &str, opts: &Options) -> HashMap<String, Value>

Parse with full engine resolution (!active mode).

Source

pub fn parse_full(text: &str) -> ParseResult

Parse and return full result including mode and metadata.

Source

pub fn parse_tool(text: &str, opts: &Options) -> HashMap<String, Value>

Parse a !tool call: returns { tool: "name", params: { ... } }.

If the text is also !active, markers (:env, :default, etc.) are resolved before reshaping.

Source

pub fn stringify(value: &Value) -> String

Stringify a Value back to SYNX format.

Source

pub fn format(text: &str) -> String

Reformat a .synx string into canonical form:

  • Keys sorted alphabetically at every nesting level
  • Exactly 2 spaces per indentation level
  • One blank line between top-level blocks (objects / lists)
  • Comments stripped — canonical form is comment-free
  • Directive lines (!active, !lock) preserved at the top

The same data always produces byte-for-byte identical output, making .synx files deterministic and noise-free in git diff.

Source

pub fn compile(text: &str, resolved: bool) -> Vec<u8>

Compile a .synx string into compact binary .synxb format.

If resolved is true, active markers are resolved first (requires !active mode) and metadata is stripped from the output.

Source

pub fn decompile(data: &[u8]) -> Result<String, String>

Decompile a .synxb binary back into a human-readable .synx string.

Source

pub fn is_synxb(data: &[u8]) -> bool

Check if data is a .synxb binary file.

Source

pub fn diff( a: &HashMap<String, Value>, b: &HashMap<String, Value>, ) -> DiffResult

Structural diff between two parsed SYNX objects.

Returns added / removed / changed / unchanged keys.

Auto Trait Implementations§

§

impl Freeze for Synx

§

impl RefUnwindSafe for Synx

§

impl Send for Synx

§

impl Sync for Synx

§

impl Unpin for Synx

§

impl UnsafeUnpin for Synx

§

impl UnwindSafe for Synx

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.