pub trait EntityRead: Entity {
type CustomReadError: Debug + Error;
// Provided methods
fn last_git_commit(
replica: &Replica,
id: EntityId<Self>,
) -> Result<ObjectId, Error> { ... }
fn breadth_first_search(
repo: &Repository,
root_id: ObjectId,
) -> Result<Vec<Commit<'_>>, Error> { ... }
fn read(replica: &Replica, id: EntityId<Self>) -> Result<Self, Error<Self>>
where Self: Sized { ... }
}Expand description
Required Associated Types§
Sourcetype CustomReadError: Debug + Error
type CustomReadError: Debug + Error
An error that can be used to add to the default Error in read.
Defining this is only really useful, if you override the default
read method. Otherwise, you can set this to
std::convert::Infallible (we would do this here, but
default associated types are not stable yet).
Provided Methods§
Sourcefn last_git_commit(
replica: &Replica,
id: EntityId<Self>,
) -> Result<ObjectId, Error>
fn last_git_commit( replica: &Replica, id: EntityId<Self>, ) -> Result<ObjectId, Error>
Get the commit associated with the last entry of this
Entity's Operations.
Conceptually, this just resolves the git reference at
refs/Self::NAMESPACE/id.
§Errors
If the reference could not be resolved (e.g., it was missing.)
Sourcefn breadth_first_search(
repo: &Repository,
root_id: ObjectId,
) -> Result<Vec<Commit<'_>>, Error>
fn breadth_first_search( repo: &Repository, root_id: ObjectId, ) -> Result<Vec<Commit<'_>>, Error>
A breadth-first search to get a topological order of the Operations DAG where we discover the parents commit and go back in time up to the chronological root
§Errors
If one of the git Ids has no commit object attached to it.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.