Enum bonsaidb::core::schema::NamedReference [−][src]
pub enum NamedReference<'a, Id> {
Name(Cow<'a, str>),
Id(DocumentId),
Key(Id),
}
Expand description
A reference to a collection that has a unique name view.
Variants
Name(Cow<'a, str>)
An entity’s name.
Id(DocumentId)
Tuple Fields
0: DocumentId
A document id.
Key(Id)
A document id.
Implementations
Converts this reference to an owned reference with a 'static
lifetime.
pub fn id<Col, Cn>(
&self,
connection: &Cn
) -> Result<Option<<Col as Collection>::PrimaryKey>, Error> where
Col: NamedCollection<PrimaryKey = Id>,
Cn: Connection,
pub fn id<Col, Cn>(
&self,
connection: &Cn
) -> Result<Option<<Col as Collection>::PrimaryKey>, Error> where
Col: NamedCollection<PrimaryKey = Id>,
Cn: Connection,
Returns this reference’s id. If the reference is a name, the
NamedCollection::ByNameView
is queried for the id.
pub async fn id_async<Col, Cn>(
&'_ self,
connection: &'_ Cn
) -> Result<Option<<Col as Collection>::PrimaryKey>, Error> where
Col: NamedCollection<PrimaryKey = Id>,
Cn: AsyncConnection,
pub async fn id_async<Col, Cn>(
&'_ self,
connection: &'_ Cn
) -> Result<Option<<Col as Collection>::PrimaryKey>, Error> where
Col: NamedCollection<PrimaryKey = Id>,
Cn: AsyncConnection,
Returns this reference’s id. If the reference is a name, the
NamedCollection::ByNameView
is queried for the id.
Trait Implementations
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<NamedReference<'a, Id>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<NamedReference<'a, Id>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Returns this name as a NamedReference
.
impl<'a, Id> PartialEq<NamedReference<'a, Id>> for NamedReference<'a, Id> where
Id: PartialEq<Id>,
impl<'a, Id> PartialEq<NamedReference<'a, Id>> for NamedReference<'a, Id> where
Id: PartialEq<Id>,
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<'a, 'c, C> TryFrom<&'c CollectionDocument<C>> for NamedReference<'a, <C as Collection>::PrimaryKey> where
C: SerializedCollection,
impl<'a, 'c, C> TryFrom<&'c CollectionDocument<C>> for NamedReference<'a, <C as Collection>::PrimaryKey> where
C: SerializedCollection,
pub fn try_from(
doc: &'c CollectionDocument<C>
) -> Result<NamedReference<'a, <C as Collection>::PrimaryKey>, Error>
pub fn try_from(
doc: &'c CollectionDocument<C>
) -> Result<NamedReference<'a, <C as Collection>::PrimaryKey>, Error>
Performs the conversion.
Auto Trait Implementations
impl<'a, Id> RefUnwindSafe for NamedReference<'a, Id> where
Id: RefUnwindSafe,
impl<'a, Id> Send for NamedReference<'a, Id> where
Id: Send,
impl<'a, Id> Sync for NamedReference<'a, Id> where
Id: Sync,
impl<'a, Id> Unpin for NamedReference<'a, Id> where
Id: Unpin,
impl<'a, Id> UnwindSafe for NamedReference<'a, Id> where
Id: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more