Trait datafu::PatternTypes[][src]

pub trait PatternTypes {
    type Ref: ?Sized;
    type Own: Copy + 'static;
    fn matches(
        left: RefOwn<'_, Self::Ref, Self::Own>,
        right: RefOwn<'_, Self::Ref, Self::Own>
    ) -> bool;
fn as_str<'b>(value: RefOwn<'b, Self::Ref, Self::Own>) -> Option<&'b str>; fn pairs<'b>(
        item: RefOwn<'b, Self::Ref, Self::Own>
    ) -> Option<Box<dyn Iterator<Item = KVPair<'b, Self>> + 'b>> { ... }
fn get<'a, 'b>(
        item: RefOwn<'b, Self::Ref, Self::Own>,
        key: RefOwn<'a, Self::Ref, Self::Own>
    ) -> Option<Option<KVPair<'b, Self>>> { ... } }

Defines the types and operations used for matching.

Associated Types

type Ref: ?Sized[src]

The borrowed type.

type Own: Copy + 'static[src]

The owned type.

Loading content...

Required methods

fn matches(
    left: RefOwn<'_, Self::Ref, Self::Own>,
    right: RefOwn<'_, Self::Ref, Self::Own>
) -> bool
[src]

Returns whether two keys/values are the same/equivalent. This must provide the same guarantees as PartialEq. In fact, this is a replacement for PartialEq for cases where it's not possible to just use PartialEq.

fn as_str<'b>(value: RefOwn<'b, Self::Ref, Self::Own>) -> Option<&'b str>[src]

Returns the value as an &str.

Loading content...

Provided methods

fn pairs<'b>(
    item: RefOwn<'b, Self::Ref, Self::Own>
) -> Option<Box<dyn Iterator<Item = KVPair<'b, Self>> + 'b>>
[src]

Returns an iterator over key-value pairs contained within an item, or None if this operation is unsupported for the given value.

fn get<'a, 'b>(
    item: RefOwn<'b, Self::Ref, Self::Own>,
    key: RefOwn<'a, Self::Ref, Self::Own>
) -> Option<Option<KVPair<'b, Self>>>
[src]

Returns an optional key-value pair keyed by the given key, or None if this operation is unsupported for the given value.

Loading content...

Implementors

Loading content...