pub struct Ided<T: Identifiable, E = T> { /* private fields */ }
Expand description
Short for “Identified”, wraps a struct and its identifier.
The concrete type should most often be defined with only
one identifiable type, eg Ided<Invoice>
, but it’s also
possible to wrap an object with a non directly linked id,
as in Ided<Invoice, InvoiceExpanded>
.
Equality and Hash implementations are based on the id: objects are the same when they have the same id.
Ordering implementation of the Ided is based on the ordering of the wrapped entity.
Implementations§
source§impl<T: Identifiable, E> Ided<T, E>
impl<T: Identifiable, E> Ided<T, E>
sourcepub fn entity_mut(&mut self) -> &mut E
pub fn entity_mut(&mut self) -> &mut E
Return a mutable reference to the wrapped entity
sourcepub fn take_entity(self) -> E
pub fn take_entity(self) -> E
Return the entity, dropping the item
Trait Implementations§
source§impl<T: Identifiable, E> AsRef<E> for Ided<T, E>
impl<T: Identifiable, E> AsRef<E> for Ided<T, E>
source§impl<T: Identifiable, E> Deref for Ided<T, E>
impl<T: Identifiable, E> Deref for Ided<T, E>
source§impl<'de, T, E> Deserialize<'de> for Ided<T, E>
impl<'de, T, E> Deserialize<'de> for Ided<T, E>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<O: Identifiable> Hash for Ided<O>
impl<O: Identifiable> Hash for Ided<O>
source§impl<O: Identifiable + JsonSchema> JsonSchema for Ided<O>
impl<O: Identifiable + JsonSchema> JsonSchema for Ided<O>
source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moresource§impl<T: Identifiable, E: Ord> Ord for Ided<T, E>
impl<T: Identifiable, E: Ord> Ord for Ided<T, E>
source§impl<T: Identifiable, E> PartialEq for Ided<T, E>
impl<T: Identifiable, E> PartialEq for Ided<T, E>
source§impl<T: Identifiable, E: Ord> PartialOrd for Ided<T, E>
impl<T: Identifiable, E: Ord> PartialOrd for Ided<T, E>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<T: Identifiable, E> Eq for Ided<T, E>
Auto Trait Implementations§
impl<T, E> RefUnwindSafe for Ided<T, E>where
E: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, E> Send for Ided<T, E>
impl<T, E> Sync for Ided<T, E>
impl<T, E> Unpin for Ided<T, E>
impl<T, E> UnwindSafe for Ided<T, E>where
E: UnwindSafe,
T: UnwindSafe,
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.