Struct mentat_ffi::NamespacedKeyword [] [src]

pub struct NamespacedKeyword {
    pub namespace: String,
    pub name: String,
}

Fields

Methods

impl NamespacedKeyword
[src]

[src]

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.

[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());

[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());

[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());

[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 Hash for NamespacedKeyword
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl PartialOrd<NamespacedKeyword> for NamespacedKeyword
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

[src]

This method tests less than (for self and other) and is used by the < operator. Read more

[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<'de> Deserialize<'de> for NamespacedKeyword
[src]

[src]

Deserialize this value from the given Serde deserializer. Read more

impl Debug for NamespacedKeyword
[src]

[src]

Formats the value using the given formatter. Read more

impl Clone for NamespacedKeyword
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Serialize for NamespacedKeyword
[src]

[src]

Serialize this value into the given Serde serializer. Read more

impl Ord for NamespacedKeyword
[src]

[src]

This method returns an Ordering between self and other. Read more

1.21.0
[src]

Compares and returns the maximum of two values. Read more

1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl Display for NamespacedKeyword
[src]

[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());

impl Eq for NamespacedKeyword
[src]

impl PartialEq<NamespacedKeyword> for NamespacedKeyword
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl From<NamespacedKeyword> for TypedValue
[src]

[src]

Performs the conversion.