Skip to main content

LogosContains

Trait LogosContains 

Source
pub trait LogosContains<T> {
    // Required method
    fn logos_contains(&self, value: &T) -> bool;
}
Expand description

Unified containment testing for all collection types.

This trait provides a consistent logos_contains method across Logos’s collection types, abstracting over the different containment semantics of vectors (by value), sets (by membership), maps (by key), and strings (by substring or character).

§Implementations

  • Vec<T>: Tests if the vector contains an element equal to the value
  • [HashSet<T>]: Tests if the element is a member of the set
  • [HashMap<K, V>]: Tests if a key exists in the map
  • String: Tests for substring (&str) or character (char) presence
  • [ORSet<T, B>]: Tests if the element is in the CRDT set

§Examples

use logicaffeine_data::LogosContains;

// Vector: contains by value equality
let v = vec![1, 2, 3];
assert!(v.logos_contains(&2));
assert!(!v.logos_contains(&5));

// String: contains by substring
let s = String::from("hello world");
assert!(s.logos_contains(&"world"));

// String: contains by character
assert!(s.logos_contains(&'o'));

Required Methods§

Source

fn logos_contains(&self, value: &T) -> bool

Check if this collection contains the given value.

Implementations on Foreign Types§

Source§

impl LogosContains<&str> for String

Source§

fn logos_contains(&self, value: &&str) -> bool

Source§

impl LogosContains<char> for String

Source§

fn logos_contains(&self, value: &char) -> bool

Source§

impl LogosContains<String> for String

Source§

fn logos_contains(&self, value: &String) -> bool

Source§

impl<K: Eq + Hash, V> LogosContains<K> for HashMap<K, V>

Source§

fn logos_contains(&self, key: &K) -> bool

Source§

impl<T: Eq + Hash> LogosContains<T> for HashSet<T>

Source§

fn logos_contains(&self, value: &T) -> bool

Source§

impl<T: PartialEq> LogosContains<T> for Vec<T>

Source§

fn logos_contains(&self, value: &T) -> bool

Implementors§

Source§

impl<T: Eq + Hash + Clone, B: SetBias> LogosContains<T> for ORSet<T, B>