pub struct RoleType {
pub label: ScopedLabel,
pub is_root: bool,
pub is_abstract: bool,
}
Expand description
Roles are special internal types used by relations. We can not create an instance of a role in a database. But we can set an instance of another type (role player) to play a role in a particular instance of a relation type.
Roles allow a schema to enforce logical constraints on types of role players.
Fields§
§label: ScopedLabel
§is_root: bool
§is_abstract: bool
Trait Implementations§
Source§impl RoleTypeAPI for RoleType
impl RoleTypeAPI for RoleType
Source§fn is_abstract(&self) -> bool
fn is_abstract(&self) -> bool
Checks if the type is prevented from having data instances (i.e.,
abstract
). Read moreSource§fn get_relation_type<'tx>(
&self,
transaction: &'tx Transaction<'_>,
) -> BoxPromise<'tx, Result<Option<RelationType>>>
fn get_relation_type<'tx>( &self, transaction: &'tx Transaction<'_>, ) -> BoxPromise<'tx, Result<Option<RelationType>>>
Retrieves the
RelationType
that this role is directly related to. Read moreSource§fn is_deleted<'tx>(
&self,
transaction: &'tx Transaction<'_>,
) -> BoxPromise<'tx, Result<bool>>
fn is_deleted<'tx>( &self, transaction: &'tx Transaction<'_>, ) -> BoxPromise<'tx, Result<bool>>
Checks if this type is deleted. Read more
Source§fn delete<'tx>(
&self,
transaction: &'tx Transaction<'_>,
) -> BoxPromise<'tx, Result>
fn delete<'tx>( &self, transaction: &'tx Transaction<'_>, ) -> BoxPromise<'tx, Result>
Deletes this type from the database. Read more
Source§fn set_label<'tx>(
&self,
transaction: &'tx Transaction<'_>,
new_label: String,
) -> BoxPromise<'tx, Result>
fn set_label<'tx>( &self, transaction: &'tx Transaction<'_>, new_label: String, ) -> BoxPromise<'tx, Result>
Renames the label of the type. The new label must remain unique. Read more
Source§fn get_supertype<'tx>(
&self,
transaction: &'tx Transaction<'_>,
) -> BoxPromise<'tx, Result<Option<RoleType>>>
fn get_supertype<'tx>( &self, transaction: &'tx Transaction<'_>, ) -> BoxPromise<'tx, Result<Option<RoleType>>>
Retrieves the most immediate supertype of the
RoleType
. Read moreSource§fn get_supertypes<'tx>(
&self,
transaction: &'tx Transaction<'_>,
) -> Result<BoxStream<'tx, Result<RoleType>>>
fn get_supertypes<'tx>( &self, transaction: &'tx Transaction<'_>, ) -> Result<BoxStream<'tx, Result<RoleType>>>
Retrieves all supertypes of the
RoleType
. Read moreSource§fn get_subtypes<'tx>(
&self,
transaction: &'tx Transaction<'_>,
transitivity: Transitivity,
) -> Result<BoxStream<'tx, Result<RoleType>>>
fn get_subtypes<'tx>( &self, transaction: &'tx Transaction<'_>, transitivity: Transitivity, ) -> Result<BoxStream<'tx, Result<RoleType>>>
Retrieves all direct and indirect (or direct only) subtypes of the
RoleType
. Read moreSource§fn get_relation_types<'tx>(
&self,
transaction: &'tx Transaction<'_>,
) -> Result<BoxStream<'tx, Result<RelationType>>>
fn get_relation_types<'tx>( &self, transaction: &'tx Transaction<'_>, ) -> Result<BoxStream<'tx, Result<RelationType>>>
Retrieves
RelationType
s that this role is related to (directly or indirectly). Read moreSource§fn get_player_types<'tx>(
&self,
transaction: &'tx Transaction<'_>,
transitivity: Transitivity,
) -> Result<BoxStream<'tx, Result<ThingType>>>
fn get_player_types<'tx>( &self, transaction: &'tx Transaction<'_>, transitivity: Transitivity, ) -> Result<BoxStream<'tx, Result<ThingType>>>
Retrieves the
ThingType
s whose instances play this role. Read moreSource§fn get_relation_instances<'tx>(
&self,
transaction: &'tx Transaction<'_>,
transitivity: Transitivity,
) -> Result<BoxStream<'tx, Result<Relation>>>
fn get_relation_instances<'tx>( &self, transaction: &'tx Transaction<'_>, transitivity: Transitivity, ) -> Result<BoxStream<'tx, Result<Relation>>>
Retrieves the
Relation
instances that this role is related to. Read moreSource§fn get_player_instances<'tx>(
&self,
transaction: &'tx Transaction<'_>,
transitivity: Transitivity,
) -> Result<BoxStream<'tx, Result<Thing>>>
fn get_player_instances<'tx>( &self, transaction: &'tx Transaction<'_>, transitivity: Transitivity, ) -> Result<BoxStream<'tx, Result<Thing>>>
Retrieves the
Thing
instances that play this role. Read moreimpl Eq for RoleType
impl StructuralPartialEq for RoleType
Auto Trait Implementations§
impl Freeze for RoleType
impl RefUnwindSafe for RoleType
impl Send for RoleType
impl Sync for RoleType
impl Unpin for RoleType
impl UnwindSafe for RoleType
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request