pub enum Reference<T>where
    T: Clone,
{ Id(String), Resolved(TypedRecord<T>), }
Expand description

A reference is an enum that can be in two states: It either holds an ID to a record, or a loaded record.

Variants

Id(String)

Resolved(TypedRecord<T>)

Implementations

Get the target id of the reference.

Get the loaded record if the reference is resolved.

Get a mutable reference to the loaded record if the reference is resolved.

Get the loaded record if the reference is resolved, while consuming the reference.

Extract the loaded record if the reference is resolved, while converting the reference to only hold an id.

Check if the reference is resolved and contains a loaded record.

Resolve this reference with a Resolver if the reference is not yet in the resolved state.

The Resolver trait is implemented on data stores.

Resolve the record, even if the reference is already in the resolved state.

Resolve the record while consuming self, and return a new reference in the resolved state.

Set the record to the resolved state while passing in the target record.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Converts to this type from the input type.
The name of the generated JSON Schema. Read more
Generates a JSON Schema for this type. Read more
Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts self into a collection.
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
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