Fix comments in EDN crate.

This commit is contained in:
Richard Newman 2017-01-30 17:39:32 -08:00
parent 00bb3e6d4a
commit 932a42866c
2 changed files with 10 additions and 7 deletions

View file

@ -64,7 +64,7 @@ pub struct Keyword(pub String);
#[derive(Clone,Debug,Eq,Hash,Ord,PartialOrd,PartialEq)] #[derive(Clone,Debug,Eq,Hash,Ord,PartialOrd,PartialEq)]
pub struct NamespacedKeyword { pub struct NamespacedKeyword {
// We derive PartialOrd, which implements a lexicographic based // We derive PartialOrd, which implements a lexicographic order based
// on the order of members, so put namespace first. // on the order of members, so put namespace first.
pub namespace: String, pub namespace: String,
pub name: String, pub name: String,
@ -123,13 +123,16 @@ impl NamespacedKeyword {
} }
} }
/// Whether this NamespacedKeyword should be interpreted in reverse order. For example, /// Whether this `NamespacedKeyword` should be interpreted in reverse order. For example,
/// the two following snippets are identical: /// the two following snippets are identical:
///
/// ```edn
/// [?y :person/friend ?x] /// [?y :person/friend ?x]
/// [?x :person/hired ?y] /// [?x :person/hired ?y]
/// ///
/// [?y :person/friend ?x] /// [?y :person/friend ?x]
/// [?y :person/_hired ?x] /// [?y :person/_hired ?x]
/// ```
/// ///
/// # Examples /// # Examples
/// ///
@ -143,7 +146,7 @@ impl NamespacedKeyword {
self.name.starts_with("_") self.name.starts_with("_")
} }
/// Whether this NamespacedKeyword should be interpreted in forward order. /// Whether this `NamespacedKeyword` should be interpreted in forward order.
/// See `symbols::NamespacedKeyword::is_backwards`. /// See `symbols::NamespacedKeyword::is_backwards`.
/// ///
/// # Examples /// # Examples
@ -158,8 +161,8 @@ impl NamespacedKeyword {
!self.is_backward() !self.is_backward()
} }
/// Returns an Option<NamespacedKeyword> with the same name and namespace, but /// Returns a `NamespacedKeyword` with the same namespace and a
/// considered reversed. See `symbols::NamespacedKeyword::is_backward`. /// 'backward' name. See `symbols::NamespacedKeyword::is_backward`.
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -33,8 +33,8 @@ pub enum Value {
Vector(Vec<Value>), Vector(Vec<Value>),
List(LinkedList<Value>), List(LinkedList<Value>),
// We're using BTree{Set, Map} rather than Hash{Set, Map} because the BTree variants // We're using BTree{Set, Map} rather than Hash{Set, Map} because the BTree variants
// implement Hash (unlike the Hash variants which don't in order to preserve O(n) hashing // implement Hash. The Hash variants don't in order to preserve O(n) hashing
// time which is hard given recurrsive data structures) // time, which is hard given recursive data structures.
// See https://internals.rust-lang.org/t/implementing-hash-for-hashset-hashmap/3817/1 // See https://internals.rust-lang.org/t/implementing-hash-for-hashset-hashmap/3817/1
Set(BTreeSet<Value>), Set(BTreeSet<Value>),
Map(BTreeMap<Value, Value>), Map(BTreeMap<Value, Value>),