Struct edn::symbols::NamespacedKeyword
[−]
[src]
pub struct NamespacedKeyword { pub namespace: String, pub name: String, }
Fields
namespace: String
name: String
Methods
impl NamespacedKeyword
[src]
pub fn new<T>(namespace: T, name: T) -> Self where
T: Into<String>,
[src]
T: Into<String>,
Creates a new NamespacedKeyword
.
Examples
let keyword = NamespacedKeyword::new("foo", "bar"); assert_eq!(keyword.to_string(), ":foo/bar");
See also the kw!
macro in the main mentat
crate.
pub fn is_backward(&self) -> bool
[src]
Whether this NamespacedKeyword
should be interpreted in reverse order. For example,
the two following snippets are identical:
[?y :person/friend ?x]
[?x :person/hired ?y]
[?y :person/friend ?x]
[?y :person/_hired ?x]
Examples
assert!(!NamespacedKeyword::new("foo", "bar").is_backward()); assert!(NamespacedKeyword::new("foo", "_bar").is_backward());
pub fn is_forward(&self) -> bool
[src]
Whether this NamespacedKeyword
should be interpreted in forward order.
See symbols::NamespacedKeyword::is_backward
.
Examples
assert!(NamespacedKeyword::new("foo", "bar").is_forward()); assert!(!NamespacedKeyword::new("foo", "_bar").is_forward());
pub fn to_reversed(&self) -> NamespacedKeyword
[src]
Returns a NamespacedKeyword
with the same namespace and a
'backward' name. See symbols::NamespacedKeyword::is_backward
.
Examples
let nsk = NamespacedKeyword::new("foo", "bar"); assert!(!nsk.is_backward()); assert_eq!(":foo/bar", nsk.to_string()); let reversed = nsk.to_reversed(); assert!(reversed.is_backward()); assert_eq!(":foo/_bar", reversed.to_string());
pub fn unreversed(&self) -> Option<NamespacedKeyword>
[src]
If this NamespacedKeyword
is 'backward' (see symbols::NamespacedKeyword::is_backward
),
return Some('forward name')
; otherwise, return None
.
Examples
let nsk = NamespacedKeyword::new("foo", "bar"); assert_eq!(None, nsk.unreversed()); let reversed = nsk.to_reversed(); assert_eq!(Some(nsk), reversed.unreversed());
Trait Implementations
impl Clone for NamespacedKeyword
[src]
fn clone(&self) -> NamespacedKeyword
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for NamespacedKeyword
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Eq for NamespacedKeyword
[src]
impl Hash for NamespacedKeyword
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Ord for NamespacedKeyword
[src]
fn cmp(&self, __arg_0: &NamespacedKeyword) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl PartialOrd for NamespacedKeyword
[src]
fn partial_cmp(&self, __arg_0: &NamespacedKeyword) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &NamespacedKeyword) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &NamespacedKeyword) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &NamespacedKeyword) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &NamespacedKeyword) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl PartialEq for NamespacedKeyword
[src]
fn eq(&self, __arg_0: &NamespacedKeyword) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &NamespacedKeyword) -> bool
[src]
This method tests for !=
.
impl Display for NamespacedKeyword
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Print the keyword in EDN format.
Examples
assert_eq!(":bar/baz", NamespacedKeyword::new("bar", "baz").to_string()); assert_eq!(":bar/_baz", NamespacedKeyword::new("bar", "baz").to_reversed().to_string()); assert_eq!(":bar/baz", NamespacedKeyword::new("bar", "baz").to_reversed().to_reversed().to_string());