Sign in

    cirru-edn

    Extensible Data Notation in Cirru

    cirru
    edn
    Download zip
    Author
    Version
    0.2.0
    License
    Apache-2.0
    Last updated
    last year
    Downloads
    69

    #tiye/cirru-edn

    Experimental port from cirru-edn.rs .

    moon install tiye/cirru-edn

    import it as edn:

    "import": [{ "path": "tiye/cirru-edn", "alias": "edn" }],

    using @edn {type Edn}
    match (try? Edn::parse(demo)) {
    Ok(x) => {
    println(x.to_string())
    println(x.format?(use_inline=false).unwrap())
    }
    Err(e) => println("error:" + e.to_string())
    }

    Or parse with @strconv.parse!:

    let parsed : Edn = try! @strconv.from_str("atom 1")

    parsed.format?(use_inline=false).unwrap() // "atom 1"

    TODO

    • tests
    • any ref

    EdnCommonError

    pub(all) suberror EdnCommonError String

    Edn

    pub(all) enum Edn {
    Nil
    Bool(Bool)
    Number(Double)
    Symbol(String)
    Tag(EdnTag)
    Str(String)
    Quote(
    Cirru
    )
    Tuple(EdnTupleView)
    List(EdnListView)
    Set(EdnSetView)
    Map(EdnMapView)
    Record(EdnRecordView)
    Buffer(EdnBufferView)
    Atom(Edn)
    }

    Edn data type, used in Calcit
    impl Compare for Edn
    impl Default for Edn
    impl Eq for Edn
    impl Hash for Edn
    impl Show for Edn
    impl FromStr for Edn

    Edn::format

    fn Edn::format(data : Edn, use_inline? : Bool) -> String raise EdnCommonError

    generate Cirru code from Edn

    Edn::is_literal

    fn Edn::is_literal(self : Edn) -> Bool

    Edn::parse

    parse Cirru code into data

    Edn::str

    #deprecated("use Edn::Str() instead")
    fn Edn::str(s : String) -> Edn

    Edn::symbol

    #deprecated("use Edn::Symbol() instead")
    fn Edn::symbol(s : String) -> Edn

    Edn::tag

    #deprecated("use Edn::Tag() instead")
    fn Edn::tag(s : String) -> Edn

    Edn::tuple

    fn Edn::tuple(tag : Edn, extra : Array[Edn]) -> Edn

    EdnBufferView

    type EdnBufferView

    impl Eq for EdnBufferView

    EdnListView

    type EdnListView

    impl Eq for EdnListView

    EdnListView::get

    fn EdnListView::get(self : EdnListView, idx : UInt) -> Edn?

    EdnListView::get_or_nil

    fn EdnListView::get_or_nil(self : EdnListView, idx : UInt) -> Edn

    EdnListView::is_empty

    fn EdnListView::is_empty(self : EdnListView) -> Bool

    EdnListView::iter

    fn EdnListView::iter(self : EdnListView) -> Iter[Edn]

    implement iterator for EdnListView

    EdnListView::length

    fn EdnListView::length(self : EdnListView) -> UInt

    EdnListView::push

    fn EdnListView::push(self : EdnListView, x : Edn) -> Unit

    mutablely push an element to the end of the list

    EdnMapView

    type EdnMapView

    EdnMapView::get

    fn EdnMapView::get(self : EdnMapView, k : Edn) -> Edn?

    EdnMapView::get_or_nil

    fn EdnMapView::get_or_nil(self : EdnMapView, k : Edn) -> Edn

    EdnMapView::insert

    fn EdnMapView::insert(self : EdnMapView, k : Edn, v : Edn) -> Unit

    EdnMapView::insert_key_str

    fn EdnMapView::insert_key_str(self : EdnMapView, k : String, v : Edn) -> Unit

    EdnMapView::is_empty

    fn EdnMapView::is_empty(self : EdnMapView) -> Bool

    EdnMapView::length

    fn EdnMapView::length(self : EdnMapView) -> UInt

    EdnMapView::str_get

    fn EdnMapView::str_get(self : EdnMapView, k : String) -> Edn?

    EdnMapView::tag_get

    fn EdnMapView::tag_get(self : EdnMapView, k : Edn) -> Edn?

    EdnRecordView

    pub(all) struct EdnRecordView {
    tag : EdnTag
    extra : Array[(EdnTag, Edn)]
    }

    impl Eq for EdnRecordView

    EdnRecordView::has_key

    fn EdnRecordView::has_key(self : EdnRecordView, key : EdnTag) -> Bool

    determines if the record has a key

    EdnRecordView::insert

    fn EdnRecordView::insert(self : EdnRecordView, key : EdnTag, value : Edn) -> Unit

    order not guaranteed yet, better be sorted before used by runtime

    EdnRecordView::new

    fn EdnRecordView::new(tag : EdnTag, extra : Array[(EdnTag, Edn)]) -> EdnRecordView

    EdnSetView

    impl Eq for EdnSetView
    impl Hash for EdnSetView

    EdnSetView::add

    fn EdnSetView::add(self : EdnSetView, x : Edn) -> Unit

    EdnSetView::contains

    fn EdnSetView::contains(self : EdnSetView, x : Edn) -> Bool

    EdnSetView::inner

    #deprecated("Use `struct T(A)` to declare a newtype and use `.0` access the underlying type instead.")
    fn EdnSetView::inner(self : EdnSetView) ->
    HashSet
    [Edn]
    Convert newtype to its underlying type, automatically derived.

    EdnSetView::is_empty

    fn EdnSetView::is_empty(self : EdnSetView) -> Bool

    EdnSetView::length

    fn EdnSetView::length(self : EdnSetView) -> UInt

    EdnTag

    pub type EdnTag String

    impl Compare for EdnTag
    impl Eq for EdnTag
    impl Hash for EdnTag
    impl Show for EdnTag

    EdnTag::inner

    #deprecated("Use `struct T(A)` to declare a newtype and use `.0` access the underlying type instead.")
    fn EdnTag::inner(self : EdnTag) -> String
    Convert newtype to its underlying type, automatically derived.

    EdnTag::new

    fn EdnTag::new(s : String) -> EdnTag

    EdnTag::str

    fn EdnTag::str(self : EdnTag) -> String

    EdnTupleView

    pub(all) struct EdnTupleView {
    tag : Edn
    extra : Array[Edn]
    }

    impl Eq for EdnTupleView

    EdnTupleView::new

    fn EdnTupleView::new(tag : Edn, extra : Array[Edn]) -> EdnTupleView

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io