pub struct Id<E: Entity>(/* private fields */);Expand description
An application key branded with the entity that owns it. Constructing one does not read storage or prove that the row exists. An ID for one entity cannot address another entity with the same raw key.
ⓘ
use ic_db::{Database, Entity, Id};
fn wrong<A: Entity, B: Entity<Key = A::Key>>(db: &Database, id: Id<A>) {
let _ = db.get::<B>(id);
}Implementations§
Trait Implementations§
impl<E: Entity> Copy for Id<E>
Source§impl<'de, E: Entity> Deserialize<'de> for Id<E>where
E::Key: Deserialize<'de>,
impl<'de, E: Entity> Deserialize<'de> for Id<E>where
E::Key: Deserialize<'de>,
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
impl<E: Entity> Eq for Id<E>
Source§impl<E: Entity<Key = Subaccount>> From<[u8; 32]> for Id<E>
impl<E: Entity<Key = Subaccount>> From<[u8; 32]> for Id<E>
Source§fn from(key: Subaccount) -> Self
fn from(key: Subaccount) -> Self
Converts to this type from the input type.
Source§impl<E: Entity> Ord for Id<E>
impl<E: Entity> Ord for Id<E>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl<E: Entity> PartialOrd for Id<E>where
E::Key: PartialOrd,
impl<E: Entity> PartialOrd for Id<E>where
E::Key: PartialOrd,
Auto Trait Implementations§
impl<E> Forget for Id<E>
impl<E> Freeze for Id<E>
impl<E> Move for Id<E>
impl<E> RefUnwindSafe for Id<E>
impl<E> Send for Id<E>
impl<E> Sync for Id<E>
impl<E> Unpin for Id<E>
impl<E> UnsafeUnpin for Id<E>
impl<E> UnwindSafe for Id<E>
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