[−][src]Struct spartan_lib::core::db::TreeDatabase
Tree-based database
Used by default server implementation.
Internally, contains message storage, and index for fast lookups, thus improving performance in comparison with VecDatabase
TreeDatabase
heavily relies on correct M
implementation of Sortable
as only first element of index is used to check if there are any available messages in queue.
Trait Implementations
impl<M> Database<M> for TreeDatabase<M> where
M: Identifiable + Sortable,
<M as Identifiable>::Id: Hash,
[src]
M: Identifiable + Sortable,
<M as Identifiable>::Id: Hash,
type PositionKey = <M as Identifiable>::Id
pub fn push_raw(&mut self, message: M)
[src]
pub fn position<F>(&self, predicate: F) -> Option<Self::PositionKey> where
F: Fn(&M) -> bool,
[src]
F: Fn(&M) -> bool,
pub fn get(&self, position: Self::PositionKey) -> Option<&M>
[src]
pub fn get_mut(&mut self, position: Self::PositionKey) -> Option<&mut M>
[src]
pub fn delete_pos(&mut self, position: Self::PositionKey) -> Option<M>
[src]
pub fn retain<F>(&mut self, predicate: F) where
F: Fn(&M) -> bool,
[src]
F: Fn(&M) -> bool,
pub fn len(&self) -> usize
[src]
pub fn is_empty(&self) -> bool
[src]
pub fn clear(&mut self)
[src]
impl<M> Default for TreeDatabase<M> where
M: Identifiable + Sortable,
<M as Identifiable>::Id: Hash,
[src]
M: Identifiable + Sortable,
<M as Identifiable>::Id: Hash,
impl<'de, M> Deserialize<'de> for TreeDatabase<M> where
M: Identifiable + Sortable,
<M as Identifiable>::Id: Hash,
<M as Identifiable>::Id: Serialize + DeserializeOwned,
<M as Sortable>::Sort: Serialize + DeserializeOwned,
M: Serialize + DeserializeOwned,
[src]
M: Identifiable + Sortable,
<M as Identifiable>::Id: Hash,
<M as Identifiable>::Id: Serialize + DeserializeOwned,
<M as Sortable>::Sort: Serialize + DeserializeOwned,
M: Serialize + DeserializeOwned,
pub fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<M> Serialize for TreeDatabase<M> where
M: Identifiable + Sortable,
<M as Identifiable>::Id: Hash,
<M as Identifiable>::Id: Serialize + DeserializeOwned,
<M as Sortable>::Sort: Serialize + DeserializeOwned,
M: Serialize + DeserializeOwned,
[src]
M: Identifiable + Sortable,
<M as Identifiable>::Id: Hash,
<M as Identifiable>::Id: Serialize + DeserializeOwned,
<M as Sortable>::Sort: Serialize + DeserializeOwned,
M: Serialize + DeserializeOwned,
pub fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<M> StatusAwareDatabase<M> for TreeDatabase<M> where
M: Identifiable + Sortable + Status,
<M as Identifiable>::Id: Hash,
[src]
M: Identifiable + Sortable + Status,
<M as Identifiable>::Id: Hash,
type RequeueKey = <M as Identifiable>::Id
pub fn reserve(&mut self, position: Self::PositionKey) -> Option<&mut M>
[src]
pub fn requeue<F>(
&mut self,
position: Self::RequeueKey,
predicate: F
) -> Option<&mut M> where
F: Fn(&M) -> bool,
[src]
&mut self,
position: Self::RequeueKey,
predicate: F
) -> Option<&mut M> where
F: Fn(&M) -> bool,
Auto Trait Implementations
impl<M> RefUnwindSafe for TreeDatabase<M> where
M: RefUnwindSafe,
<M as Identifiable>::Id: RefUnwindSafe,
<M as Sortable>::Sort: RefUnwindSafe,
[src]
M: RefUnwindSafe,
<M as Identifiable>::Id: RefUnwindSafe,
<M as Sortable>::Sort: RefUnwindSafe,
impl<M> Send for TreeDatabase<M> where
M: Send,
<M as Identifiable>::Id: Send,
<M as Sortable>::Sort: Send,
[src]
M: Send,
<M as Identifiable>::Id: Send,
<M as Sortable>::Sort: Send,
impl<M> Sync for TreeDatabase<M> where
M: Sync,
<M as Identifiable>::Id: Sync,
<M as Sortable>::Sort: Sync,
[src]
M: Sync,
<M as Identifiable>::Id: Sync,
<M as Sortable>::Sort: Sync,
impl<M> Unpin for TreeDatabase<M> where
M: Unpin,
<M as Identifiable>::Id: Unpin,
[src]
M: Unpin,
<M as Identifiable>::Id: Unpin,
impl<M> UnwindSafe for TreeDatabase<M> where
M: UnwindSafe,
<M as Identifiable>::Id: RefUnwindSafe + UnwindSafe,
<M as Sortable>::Sort: RefUnwindSafe,
[src]
M: UnwindSafe,
<M as Identifiable>::Id: RefUnwindSafe + UnwindSafe,
<M as Sortable>::Sort: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,