Struct TreeObjectSpace

Source
pub struct TreeObjectSpace { /* private fields */ }
Expand description

A thread-safe reference ObjectSpace implementation

§Implementation

A TreeObjectSpace is a HashMap between a TypeId and the actual Entry structure holding the structs. Before structs are stored in Entry, they are serialized into a JSON-like structure and then flattened.

An Entry is a HashMap whose key is a flattened field and value is a BTreeMap between possible values of the field and the Vec of structs containing the corresponding value of such field.

Mutex is used sparingly to ensure blocking read and take calls do not hijack CPU cycles

Implementations§

Trait Implementations§

Source§

impl Default for TreeObjectSpace

Source§

fn default() -> TreeObjectSpace

Returns the “default value” for a type. Read more
Source§

impl ObjectSpace for TreeObjectSpace

Source§

fn write<T>(&self, obj: T)
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Add a struct to the object space. Read more
Source§

fn try_read<T>(&self) -> Option<T>
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Return a copy of a struct of type T. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn read_all<'a, T>(&'a self) -> Box<dyn Iterator<Item = T> + 'a>
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Return copies of all structs of type T. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn read<T>(&self) -> T
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Return a copy of a struct of type T. The operation blocks until such a struct is found. Read more
Source§

fn try_take<T>(&self) -> Option<T>
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Remove and return a struct of type T. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn take_all<'a, T>(&'a self) -> Box<dyn Iterator<Item = T> + 'a>
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Remove and return all structs of type T. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn take<T>(&self) -> T
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Remove and return a struct of type T. The operation blocks until such a struct is found. Read more
Source§

impl RangeLookupObjectSpace<String> for TreeObjectSpace

Source§

fn try_read_by_range<T, R>(&self, field: &str, range: R) -> Option<T>
where for<'de> T: Serialize + Deserialize<'de> + 'static, R: RangeBounds<String> + Clone,

Given a path to an element of the struct and a range of possible values, return a copy of a struct whose specified element is within the range. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn read_all_by_range<'a, T, R>( &'a self, field: &str, range: R, ) -> Box<dyn Iterator<Item = T> + 'a>
where for<'de> T: Deserialize<'de> + 'static, R: RangeBounds<String> + Clone,

Given a path to an element of the struct and a range of possible values, return copies of all structs whose specified element is within the range. Read more
Source§

fn read_by_range<T, R>(&self, field: &str, range: R) -> T
where for<'de> T: Serialize + Deserialize<'de> + 'static, R: RangeBounds<String> + Clone,

Given a path to an element of the struct and a range of possible values, return a copy of a struct whose specified element is within the range. The operation blocks until a struct satisfies the condition is found. Read more
Source§

fn try_take_by_range<T, R>(&self, field: &str, range: R) -> Option<T>
where for<'de> T: Serialize + Deserialize<'de> + 'static, R: RangeBounds<String> + Clone,

Given a path to an element of the struct and a range of possible values, remove and return a struct whose specified element is within the range. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn take_all_by_range<'a, T, R>( &'a self, field: &str, range: R, ) -> Box<dyn Iterator<Item = T> + 'a>
where for<'de> T: Deserialize<'de> + 'static, R: RangeBounds<String> + Clone,

Given a path to an element of the struct and a range of possible values, remove and return all structs whose specified element is within the range. Read more
Source§

fn take_by_range<T, R>(&self, field: &str, range: R) -> T
where for<'de> T: Serialize + Deserialize<'de> + 'static, R: RangeBounds<String> + Clone,

Given a path to an element of the struct and a range of possible values, remove and return a struct whose specified element is within the range. The operation blocks until a struct satisfies the condition is found. Read more
Source§

impl RangeLookupObjectSpace<f64> for TreeObjectSpace

Source§

fn try_read_by_range<T, R>(&self, field: &str, range: R) -> Option<T>
where for<'de> T: Serialize + Deserialize<'de> + 'static, R: RangeBounds<f64> + Clone,

Given a path to an element of the struct and a range of possible values, return a copy of a struct whose specified element is within the range. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn read_all_by_range<'a, T, R>( &'a self, field: &str, range: R, ) -> Box<dyn Iterator<Item = T> + 'a>
where for<'de> T: Deserialize<'de> + 'static, R: RangeBounds<f64> + Clone,

Given a path to an element of the struct and a range of possible values, return copies of all structs whose specified element is within the range. Read more
Source§

fn read_by_range<T, R>(&self, field: &str, range: R) -> T
where for<'de> T: Serialize + Deserialize<'de> + 'static, R: RangeBounds<f64> + Clone,

Given a path to an element of the struct and a range of possible values, return a copy of a struct whose specified element is within the range. The operation blocks until a struct satisfies the condition is found. Read more
Source§

fn try_take_by_range<T, R>(&self, field: &str, range: R) -> Option<T>
where for<'de> T: Serialize + Deserialize<'de> + 'static, R: RangeBounds<f64> + Clone,

Given a path to an element of the struct and a range of possible values, remove and return a struct whose specified element is within the range. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn take_all_by_range<'a, T, R>( &'a self, field: &str, range: R, ) -> Box<dyn Iterator<Item = T> + 'a>
where for<'de> T: Deserialize<'de> + 'static, R: RangeBounds<f64> + Clone,

Given a path to an element of the struct and a range of possible values, remove and return all structs whose specified element is within the range. Read more
Source§

fn take_by_range<T, R>(&self, field: &str, range: R) -> T
where for<'de> T: Serialize + Deserialize<'de> + 'static, R: RangeBounds<f64> + Clone,

Given a path to an element of the struct and a range of possible values, remove and return a struct whose specified element is within the range. The operation blocks until a struct satisfies the condition is found. Read more
Source§

impl RangeLookupObjectSpace<i64> for TreeObjectSpace

Source§

fn try_read_by_range<T, R>(&self, field: &str, range: R) -> Option<T>
where for<'de> T: Serialize + Deserialize<'de> + 'static, R: RangeBounds<i64> + Clone,

Given a path to an element of the struct and a range of possible values, return a copy of a struct whose specified element is within the range. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn read_all_by_range<'a, T, R>( &'a self, field: &str, range: R, ) -> Box<dyn Iterator<Item = T> + 'a>
where for<'de> T: Deserialize<'de> + 'static, R: RangeBounds<i64> + Clone,

Given a path to an element of the struct and a range of possible values, return copies of all structs whose specified element is within the range. Read more
Source§

fn read_by_range<T, R>(&self, field: &str, range: R) -> T
where for<'de> T: Serialize + Deserialize<'de> + 'static, R: RangeBounds<i64> + Clone,

Given a path to an element of the struct and a range of possible values, return a copy of a struct whose specified element is within the range. The operation blocks until a struct satisfies the condition is found. Read more
Source§

fn try_take_by_range<T, R>(&self, field: &str, range: R) -> Option<T>
where for<'de> T: Serialize + Deserialize<'de> + 'static, R: RangeBounds<i64> + Clone,

Given a path to an element of the struct and a range of possible values, remove and return a struct whose specified element is within the range. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn take_all_by_range<'a, T, R>( &'a self, field: &str, range: R, ) -> Box<dyn Iterator<Item = T> + 'a>
where for<'de> T: Deserialize<'de> + 'static, R: RangeBounds<i64> + Clone,

Given a path to an element of the struct and a range of possible values, remove and return all structs whose specified element is within the range. Read more
Source§

fn take_by_range<T, R>(&self, field: &str, range: R) -> T
where for<'de> T: Serialize + Deserialize<'de> + 'static, R: RangeBounds<i64> + Clone,

Given a path to an element of the struct and a range of possible values, remove and return a struct whose specified element is within the range. The operation blocks until a struct satisfies the condition is found. Read more
Source§

impl ValueLookupObjectSpace<String> for TreeObjectSpace

Source§

fn try_read_by_value<T>(&self, field: &str, key: &String) -> Option<T>
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, return a copy of a struct whose specified element of the specified value. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn read_all_by_value<'a, T>( &'a self, field: &str, key: &String, ) -> Box<dyn Iterator<Item = T> + 'a>
where for<'de> T: Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, return copies of all structs whose specified element of the specified value. Read more
Source§

fn read_by_value<T>(&self, field: &str, key: &String) -> T
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, return a copy of a struct whose specified element of the specified value. The operation is blocks until an element satisfies the condition is found. Read more
Source§

fn try_take_by_value<T>(&self, field: &str, key: &String) -> Option<T>
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, remove and return a struct whose specified element of the specified value. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn take_all_by_value<'a, T>( &'a self, field: &str, key: &String, ) -> Box<dyn Iterator<Item = T> + 'a>
where for<'de> T: Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, remove and return all structs whose specified element of the specified value. Read more
Source§

fn take_by_value<T>(&self, field: &str, key: &String) -> T
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, remove and return a struct whose specified element of the specified value. The operation is blocks until an element satisfies the condition is found. Read more
Source§

impl ValueLookupObjectSpace<bool> for TreeObjectSpace

Source§

fn try_read_by_value<T>(&self, field: &str, key: &bool) -> Option<T>
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, return a copy of a struct whose specified element of the specified value. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn read_all_by_value<'a, T>( &'a self, field: &str, key: &bool, ) -> Box<dyn Iterator<Item = T> + 'a>
where for<'de> T: Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, return copies of all structs whose specified element of the specified value. Read more
Source§

fn read_by_value<T>(&self, field: &str, key: &bool) -> T
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, return a copy of a struct whose specified element of the specified value. The operation is blocks until an element satisfies the condition is found. Read more
Source§

fn try_take_by_value<T>(&self, field: &str, key: &bool) -> Option<T>
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, remove and return a struct whose specified element of the specified value. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn take_all_by_value<'a, T>( &'a self, field: &str, key: &bool, ) -> Box<dyn Iterator<Item = T> + 'a>
where for<'de> T: Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, remove and return all structs whose specified element of the specified value. Read more
Source§

fn take_by_value<T>(&self, field: &str, key: &bool) -> T
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, remove and return a struct whose specified element of the specified value. The operation is blocks until an element satisfies the condition is found. Read more
Source§

impl ValueLookupObjectSpace<f64> for TreeObjectSpace

Source§

fn try_read_by_value<T>(&self, field: &str, key: &f64) -> Option<T>
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, return a copy of a struct whose specified element of the specified value. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn read_all_by_value<'a, T>( &'a self, field: &str, key: &f64, ) -> Box<dyn Iterator<Item = T> + 'a>
where for<'de> T: Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, return copies of all structs whose specified element of the specified value. Read more
Source§

fn read_by_value<T>(&self, field: &str, key: &f64) -> T
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, return a copy of a struct whose specified element of the specified value. The operation is blocks until an element satisfies the condition is found. Read more
Source§

fn try_take_by_value<T>(&self, field: &str, key: &f64) -> Option<T>
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, remove and return a struct whose specified element of the specified value. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn take_all_by_value<'a, T>( &'a self, field: &str, key: &f64, ) -> Box<dyn Iterator<Item = T> + 'a>
where for<'de> T: Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, remove and return all structs whose specified element of the specified value. Read more
Source§

fn take_by_value<T>(&self, field: &str, key: &f64) -> T
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, remove and return a struct whose specified element of the specified value. The operation is blocks until an element satisfies the condition is found. Read more
Source§

impl ValueLookupObjectSpace<i64> for TreeObjectSpace

Source§

fn try_read_by_value<T>(&self, field: &str, key: &i64) -> Option<T>
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, return a copy of a struct whose specified element of the specified value. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn read_all_by_value<'a, T>( &'a self, field: &str, key: &i64, ) -> Box<dyn Iterator<Item = T> + 'a>
where for<'de> T: Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, return copies of all structs whose specified element of the specified value. Read more
Source§

fn read_by_value<T>(&self, field: &str, key: &i64) -> T
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, return a copy of a struct whose specified element of the specified value. The operation is blocks until an element satisfies the condition is found. Read more
Source§

fn try_take_by_value<T>(&self, field: &str, key: &i64) -> Option<T>
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, remove and return a struct whose specified element of the specified value. The operation is non-blocking and will returns None if no struct satisfies condition. Read more
Source§

fn take_all_by_value<'a, T>( &'a self, field: &str, key: &i64, ) -> Box<dyn Iterator<Item = T> + 'a>
where for<'de> T: Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, remove and return all structs whose specified element of the specified value. Read more
Source§

fn take_by_value<T>(&self, field: &str, key: &i64) -> T
where for<'de> T: Serialize + Deserialize<'de> + 'static,

Given a path to an element of the struct and a possible value, remove and return a struct whose specified element of the specified value. The operation is blocks until an element satisfies the condition is found. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Erased for T