pub enum Edn {
Show 14 variants
Nil,
Bool(bool),
Number(f64),
Symbol(Arc<str>),
Tag(EdnTag),
Str(Arc<str>),
Quote(Cirru),
Tuple(EdnTupleView),
List(EdnListView),
Set(EdnSetView),
Map(EdnMapView),
Record(EdnRecordView),
Buffer(Vec<u8>),
AnyRef(EdnAnyRef),
}
Expand description
Data format based on subset of EDN, but in Cirru syntax. different parts are quote and Record.
Variants§
Nil
Bool(bool)
Number(f64)
Symbol(Arc<str>)
Tag(EdnTag)
Str(Arc<str>)
Quote(Cirru)
Tuple(EdnTupleView)
List(EdnListView)
Set(EdnSetView)
Map(EdnMapView)
Record(EdnRecordView)
Buffer(Vec<u8>)
AnyRef(EdnAnyRef)
reference to Rust data, not interpretable in Calcit
Implementations§
source§impl Edn
impl Edn
Support reading from EDN
pub fn is_literal(&self) -> bool
pub fn map_from_iter<T: IntoIterator<Item = (Edn, Edn)>>(pairs: T) -> Self
pub fn record_from_pairs(tag: EdnTag, pairs: &[(EdnTag, Edn)]) -> Self
pub fn read_string(&self) -> Result<String, String>
pub fn read_symbol_string(&self) -> Result<String, String>
pub fn read_str(&self) -> Result<Arc<str>, String>
pub fn read_symbol_str(&self) -> Result<Arc<str>, String>
pub fn read_tag_str(&self) -> Result<Arc<str>, String>
pub fn read_bool(&self) -> Result<bool, String>
pub fn read_number(&self) -> Result<f64, String>
pub fn read_quoted_cirru(&self) -> Result<Cirru, String>
sourcepub fn view_list(&self) -> Result<EdnListView, String>
pub fn view_list(&self) -> Result<EdnListView, String>
get List variant in struct
sourcepub fn view_map(&self) -> Result<EdnMapView, String>
pub fn view_map(&self) -> Result<EdnMapView, String>
get Map variant in struct
sourcepub fn view_set(&self) -> Result<EdnSetView, String>
pub fn view_set(&self) -> Result<EdnSetView, String>
get Set variant in struct
sourcepub fn view_record(&self) -> Result<EdnRecordView, String>
pub fn view_record(&self) -> Result<EdnRecordView, String>
get Record variant in struct
sourcepub fn view_tuple(&self) -> Result<EdnTupleView, String>
pub fn view_tuple(&self) -> Result<EdnTupleView, String>
get Tuple variant in struct
Trait Implementations§
source§impl From<EdnListView> for Edn
impl From<EdnListView> for Edn
source§fn from(x: EdnListView) -> Edn
fn from(x: EdnListView) -> Edn
Converts to this type from the input type.
source§impl From<EdnMapView> for Edn
impl From<EdnMapView> for Edn
source§fn from(x: EdnMapView) -> Edn
fn from(x: EdnMapView) -> Edn
Converts to this type from the input type.
source§impl From<EdnRecordView> for Edn
impl From<EdnRecordView> for Edn
source§fn from(x: EdnRecordView) -> Edn
fn from(x: EdnRecordView) -> Edn
Converts to this type from the input type.
source§impl From<EdnSetView> for Edn
impl From<EdnSetView> for Edn
source§fn from(x: EdnSetView) -> Edn
fn from(x: EdnSetView) -> Edn
Converts to this type from the input type.
source§impl From<EdnTupleView> for Edn
impl From<EdnTupleView> for Edn
source§fn from(x: EdnTupleView) -> Edn
fn from(x: EdnTupleView) -> Edn
Converts to this type from the input type.
source§impl<T> From<Option<T>> for Edn
impl<T> From<Option<T>> for Edn
Option<T>
is a special case to convert since it has it’s own implementation in core.
To handle Edn::Nil
which is dynamically typed, some code like this is required:
ⓘ
{
let v = value.map_get("<FIELD_NAME>")?;
if v == Edn::Nil {
None
} else {
Some(v.try_into()?)
}
}
source§impl Ord for Edn
impl Ord for Edn
source§impl PartialEq for Edn
impl PartialEq for Edn
source§impl PartialOrd for Edn
impl PartialOrd for Edn
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl TryFrom<Edn> for EdnListView
impl TryFrom<Edn> for EdnListView
source§impl TryFrom<Edn> for EdnMapView
impl TryFrom<Edn> for EdnMapView
source§impl TryFrom<Edn> for EdnRecordView
impl TryFrom<Edn> for EdnRecordView
source§impl TryFrom<Edn> for EdnSetView
impl TryFrom<Edn> for EdnSetView
source§impl TryFrom<Edn> for EdnTupleView
impl TryFrom<Edn> for EdnTupleView
impl Eq for Edn
Auto Trait Implementations§
impl Freeze for Edn
impl RefUnwindSafe for Edn
impl Send for Edn
impl Sync for Edn
impl Unpin for Edn
impl UnwindSafe for Edn
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