pub struct Known<'s, 'c> {
pub schema: &'s Schema,
pub cache: Option<&'c dyn CachedAttributes>,
}Expand description
A convenience wrapper around things known in memory: the schema and caches. We use a trait object here to avoid making dozens of functions generic over the type of the cache. If performance becomes a concern, we should hard-code specific kinds of cache right here, and/or eliminate the Option.
Fields§
§schema: &'s Schema§cache: Option<&'c dyn CachedAttributes>Implementations§
Source§impl<'s, 'c> Known<'s, 'c>
impl<'s, 'c> Known<'s, 'c>
pub fn for_schema(s: &'s Schema) -> Known<'s, 'static>
pub fn new(s: &'s Schema, c: Option<&'c dyn CachedAttributes>) -> Known<'s, 'c>
Source§impl Known<'_, '_>
This is CachedAttributes, but with handy generic parameters.
Why not make the trait generic? Because then we can’t use it as a trait object in Known.
impl Known<'_, '_>
This is CachedAttributes, but with handy generic parameters.
Why not make the trait generic? Because then we can’t use it as a trait object in Known.
pub fn is_attribute_cached_reverse<U>(&self, entid: U) -> bool
pub fn is_attribute_cached_forward<U>(&self, entid: U) -> bool
pub fn get_values_for_entid<U, V>( &self, schema: &Schema, attribute: U, entid: V, ) -> Option<&Vec<TypedValue>>
pub fn get_value_for_entid<U, V>( &self, schema: &Schema, attribute: U, entid: V, ) -> Option<&TypedValue>
pub fn get_entid_for_value<U>( &self, attribute: U, value: &TypedValue, ) -> Option<i64>
pub fn get_entids_for_value<U>( &self, attribute: U, value: &TypedValue, ) -> Option<&BTreeSet<i64>>
Trait Implementations§
Auto Trait Implementations§
impl<'s, 'c> !RefUnwindSafe for Known<'s, 'c>
impl<'s, 'c> !Send for Known<'s, 'c>
impl<'s, 'c> !Sync for Known<'s, 'c>
impl<'s, 'c> !UnwindSafe for Known<'s, 'c>
impl<'s, 'c> Freeze for Known<'s, 'c>
impl<'s, 'c> Unpin for Known<'s, 'c>
impl<'s, 'c> UnsafeUnpin for Known<'s, 'c>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more